/// <summary>
        /// Generate Random Mobile number
        /// Formate 050XXXXXXX 054XXXXXXX 056XXXXXXX
        /// UAE: Telephone numbers are fixed at seven digits, with area codes fixed at two or three digits.
        /// </summary>
        /// <returns></returns>
        public static string RandomFixedNumber()
        {
            string[] mobilePrefix = new string[] { "02", "03", "04", "06", "07", "08", "09" };
            int      randomIndex  = int.Parse(CommonMobileGenerators.RandomNumber(1, 7));

            return(string.Format("{0}{1}", mobilePrefix[randomIndex], CommonMobileGenerators.GenerateRandomMobileNumber()));
        }
Exemple #2
0
        /// <summary>
        /// Generates the daily mobile http transactions.
        /// Sample formate:
        /// 343092911-2|0|2016-06-11 23:56:28 |DXB-Offline-3.etisalat|d9a45e5615f4e85d|971501233331|424021623325386|10.21.172.22|Mobile|etisalat.ae|1|42402|217.164.94.115
        /// |0124F420A08C1131|3599312528232002|Galaxy S6 G920F,Samsung,GSM;35212707,Android|false|http|GET|pa.namshicdn.com|/product/46/9651/1-mobile-android-catalog.webp||Dalvik/2.1.0 (Linux; U; Android 6.0.1; SM-G920F Build/MMB29K)|1|0||||||||||
        /// </summary>
        private static void GenerateDailyMobileHttpTransactions(ulong limit, DateTime startTime, DateTime endTime, string urlsFile, string userbaseFile)
        {
            string outputFormate = "{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}|{18}|{19}|{20}|{21}|{22}|{23}|{24}|{25}|{26}|{27}|{28}|{29}|{30}|{31}|{32}|{33}|{34}"; Console.WriteLine("Generating daily mobile http transactions started at:{0} to generate {1} transactions", DateTime.Now.ToShortDateString(), limit.ToString());
            string fileName      = string.Format("data_mobile_broadband_http_{0}_{1}.txt", DateTime.Now.ToString("yyyyMMddHHmm"), CommonMobileGenerators.RandomNumberString(4));
            ulong  counter       = 0;

            Directory.CreateDirectory("./app/data");
            using (StreamWriter file = new StreamWriter(Path.Combine("./app/data", fileName)))
            {
                while (counter < limit)
                {
                    string[] userbase = DataSetReader.GetRandomUser(userbaseFile).Split('|');
                    string   lineItem = string.Format(outputFormate,
                                                      //Transaction
                                                      CommonMobileGenerators.RandomNumberString(9) + "-2",
                                                      //Transaction State
                                                      CommonMobileGenerators.RandomNumber(0, 9),
                                                      //Request Time
                                                      CommonMobileGenerators.CurrentDateTime(startTime, endTime),
                                                      //PTS Hostname
                                                      CommonMobileGenerators.PtsHostName,
                                                      //Acct-Session-Id
                                                      CommonMobileGenerators.AcctSessionId,
                                                      //Subscriber ID
                                                      userbase[0],
                                                      //IMSI
                                                      userbase[2],
                                                      //Framed IP
                                                      CommonMobileGenerators.FrameIp,
                                                      //Network Type
                                                      CommonMobileGenerators.NetworkType,
                                                      //APN
                                                      CommonMobileGenerators.ApnName,
                                                      //RAT Type
                                                      "1",
                                                      //SGSN MCC-MNC
                                                      "42402",
                                                      //SGSN IP
                                                      CommonMobileGenerators.SgsnIp,
                                                      //Cell-Id
                                                      CommonMobileGenerators.CellId,
                                                      //IMEI
                                                      userbase[1],
                                                      //Access Device
                                                      userbase[3],
                                                      //Tethered
                                                      CommonMobileGenerators.RandomBoolean(),
                                                      //Protocol
                                                      "http",
                                                      //Method
                                                      "GET",
                                                      //Host
                                                      DataSetReader.GetRandomUrl(urlsFile),
                                                      //Resource
                                                      "/product/46/9651/1-mobile-android-catalog.webp",
                                                      //Refere
                                                      "",
                                                      //User Agent
                                                      "Dalvik/2.1.0 (Linux; U; Android 6.0.1; SM-G920F Build/MMB29K)",
                                                      //Subscriber RTT
                                                      "1",
                                                      //Internet RTT
                                                      "0",
                                                      //Custom Attr1
                                                      "",
                                                      //Custom Attr2
                                                      "",
                                                      //Custom Attr3
                                                      "",
                                                      //Custom Attr4
                                                      "",
                                                      //Custom Attr5
                                                      "",
                                                      //Custom Attr6
                                                      "",
                                                      //Custom Attr7
                                                      "",
                                                      //Custom Attr8
                                                      "",
                                                      //Custom Attr9
                                                      "",
                                                      //Custom Attr10
                                                      ""
                                                      );
                    Console.WriteLine(string.Format("{0}: {1}", counter.ToString(), lineItem));
                    file.WriteLine(lineItem);
                    counter++;
                }
            }
            Console.WriteLine("Generating Random Data stopped at:{0}", DateTime.Now.ToShortTimeString());
        }