def __init__(self, host, port, ssid, security, password, url, requests_per_ten, station_list,
                 target_requests_per_ten=60, number_template="00000", num_tests=1, radio="wiphy0",
                 _debug_on=False, upstream_port="eth1",
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
        self.host = host
        self.port = port
        self.radio = radio
        self.upstream_port = upstream_port
        self.ssid = ssid
        self.security = security
        self.password = password
        self.url = url
        self.requests_per_ten = requests_per_ten
        self.number_template = number_template
        self.sta_list = station_list
        self.num_tests = num_tests
        self.target_requests_per_ten = target_requests_per_ten

        self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
        self.station_profile = self.local_realm.new_station_profile()
        self.cx_profile = self.local_realm.new_l4_cx_profile()

        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.ssid_pass = self.password,
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
        self.station_profile.mode = 0
        self.cx_profile.url = self.url
        self.cx_profile.requests_per_ten = self.requests_per_ten

        self.port_util = realm.PortUtils(self.local_realm)
    def __init__(self, host, port, ssid, security, password, requests_per_ten, station_list,
                 number_template="00000", radio="wiphy0", direction="dl", dest="/dev/null",
                 test_duration="5m", upstream_port="eth1",
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(host, port, _debug=_debug_on, _exit_on_fail=_exit_on_fail)
        self.host = host
        self.port = port
        self.radio = radio
        self.upstream_port = upstream_port
        self.ssid = ssid
        self.direction = direction
        self.dest = dest
        self.security = security
        self.password = password
        self.requests_per_ten = requests_per_ten
        self.number_template = number_template
        self.sta_list = station_list
        self.test_duration = test_duration

        self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
        self.station_profile = self.local_realm.new_station_profile()
        self.cx_profile = self.local_realm.new_http_profile()

        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.ssid_pass = self.password,
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
        self.station_profile.mode = 0

        self.cx_profile.requests_per_ten = self.requests_per_ten
示例#3
0
    def __init__(self,
                 host,
                 port,
                 ssid,
                 security,
                 password,
                 sta_list=None,
                 number_template="00000",
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(host,
                         port,
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        self.host = host
        self.port = port
        self.ssid = ssid
        self.security = security
        self.password = password
        self.sta_list = sta_list
        self.timeout = 120
        self.number_template = number_template
        self.debug = _debug_on
        self.local_realm = realm.Realm(lfclient_host=self.host,
                                       lfclient_port=self.port)
        self.station_profile = self.local_realm.new_station_profile()

        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.ssid_pass = self.password,
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
        self.station_profile.mode = 0
示例#4
0
    def __init__(self, ssid, security, password,ap=None, mode=0, sta_list=None, num_stations=0, prefix="00000", host="localhost", port=8080,
                 _debug_on=False, timeout=120, radio="wiphy0",
                 _exit_on_error=False,
                 _exit_on_fail=False,
                 number_template="00"):
        super().__init__(host, port, _debug=_debug_on, _exit_on_fail=_exit_on_fail)
        self.host = host
        self.port = port
        self.ssid = ssid
        self.radio = radio
        self.security = security
        self.password = password
        self.ap=ap
        self.mode=mode
        self.num_stations = num_stations
        self.sta_list = sta_list
        self.timeout = timeout
        self.prefix = prefix
        self.debug = _debug_on
        self.number_template = number_template
        self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
        self.station_profile = self.local_realm.new_station_profile()

        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.ssid_pass = self.password
        if mode is not None:
            self.station_profile.mode = mode
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
示例#5
0
    def __init__(self,
                 ssid,
                 security,
                 password,
                 url,
                 requests_per_ten,
                 station_list,
                 test_duration="2m",
                 host="localhost",
                 port=8080,
                 number_template="00000",
                 num_tests=1,
                 radio="wiphy0",
                 mode=0,
                 ap=None,
                 _debug_on=False,
                 upstream_port="eth1",
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(host,
                         port,
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _local_realm=realm.Realm(lfclient_host=host,
                                                  lfclient_port=port),
                         _exit_on_fail=_exit_on_fail)
        self.host = host
        self.port = port
        self.radio = radio
        self.upstream_port = upstream_port
        self.ssid = ssid
        self.security = security
        self.password = password
        self.mode = mode
        self.ap = ap
        self.url = url
        self.requests_per_ten = requests_per_ten
        self.number_template = number_template
        self.sta_list = station_list
        self.num_tests = num_tests
        self.target_requests_per_ten = requests_per_ten
        self.test_duration = test_duration

        self.station_profile = self.local_realm.new_station_profile()
        self.cx_profile = self.local_realm.new_l4_cx_profile()

        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.ssid_pass = self.password,
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
        self.station_profile.mode = self.mode
        if self.ap is not None:
            self.station_profile.set_command_param("add_sta", "ap", self.ap)
        self.cx_profile.url = self.url
        print(self.cx_profile.url)
        self.cx_profile.requests_per_ten = self.requests_per_ten

        self.port_util = realm.PortUtils(self.local_realm)
    def __init__(self,
                 ssid,
                 security,
                 password,
                 sta_list,
                 name_prefix,
                 upstream,
                 radio,
                 host="localhost",
                 port=8080,
                 side_a_min_rate=56,
                 side_a_max_rate=0,
                 side_b_min_rate=56,
                 side_b_max_rate=0,
                 number_template="00000",
                 test_duration="5m",
                 use_ht160=False,
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(host,
                         port,
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        self.upstream = upstream
        self.host = host
        self.port = port
        self.ssid = ssid
        self.sta_list = sta_list
        self.security = security
        self.password = password
        self.radio = radio
        self.number_template = number_template
        self.debug = _debug_on
        self.name_prefix = name_prefix
        self.test_duration = test_duration
        self.local_realm = realm.Realm(lfclient_host=self.host,
                                       lfclient_port=self.port)
        self.station_profile = self.local_realm.new_station_profile()
        self.cx_profile = self.local_realm.new_l3_cx_profile()

        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.ssid_pass = self.password
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
        self.station_profile.debug = self.debug
        self.station_profile.use_ht160 = use_ht160
        if self.station_profile.use_ht160:
            self.station_profile.mode = 9

        self.cx_profile.host = self.host
        self.cx_profile.port = self.port
        self.cx_profile.name_prefix = self.name_prefix
        self.cx_profile.side_a_min_bps = side_a_min_rate
        self.cx_profile.side_a_max_bps = side_a_max_rate
        self.cx_profile.side_b_min_bps = side_b_min_rate
        self.cx_profile.side_b_max_bps = side_b_max_rate
 def __init__(self, host, port, endp_type, side_b, radios, radio_name_list, number_of_stations_per_radio_list,
              ssid_list, ssid_password_list, security, station_lists, name_prefix, resource=1,
              side_a_min_rate=256000, side_a_max_rate=0,
              side_b_min_rate=256000, side_b_max_rate=0,
              number_template="00", test_duration="125s",
              _debug_on=False,
              _exit_on_error=False,
              _exit_on_fail=False):
     super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
     self.host = host
     self.port = port
     self.endp_type = endp_type
     self.side_b = side_b
     self.ssid_list = ssid_list
     self.ssid_password_list = ssid_password_list
     self.station_lists = station_lists       
     self.security = security
     self.number_template = number_template
     self.resource = resource
     self.name_prefix = name_prefix
     self.test_duration = test_duration
     self.cx_stations_lists = station_lists
     self.radios = radios # from the command line
     self.radio_list = radio_name_list
     self.number_of_stations_per_radio_list =  number_of_stations_per_radio_list
     self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
     self.cx_profile = self.local_realm.new_l3_cx_profile()
     self.station_profiles = []
     
     index = 0
     for radio in radios:
         self.station_profile = self.local_realm.new_station_profile()
         self.station_profile.lfclient_url = self.lfclient_url
         self.station_profile.ssid = ssid_list[index]
         self.station_profile.ssid_pass = ssid_password_list[index]
         self.station_profile.security = self.security
         self.station_profile.number_template = self.number_template
         self.station_profile.mode = 0
         self.station_profiles.append(self.station_profile)
         index += 1
     
     self.cx_profile.host = self.host
     self.cx_profile.port = self.port
     self.cx_profile.name_prefix = self.name_prefix
     self.cx_profile.side_a_min_bps = side_a_min_rate
     self.cx_profile.side_a_max_bps = side_a_max_rate
     self.cx_profile.side_b_min_bps = side_b_min_rate
     self.cx_profile.side_b_max_bps = side_b_max_rate
 def __init__(self, host, port, ssid, security, password, lan_port="eth2", wan_port="eth3", _debug_on=False,
              _exit_on_error=False,
              _exit_on_fail=False):
     super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
     self.host = host
     self.port = port
     self.ssid = ssid
     self.security = security
     self.password = password
     self.timeout = 120
     self.lan_port = lan_port
     self.wan_port = wan_port
     self.local_realm = realm.Realm(lfclient_host=self.host, lfclient_port=self.port)
     self.profile = realm.StationProfile(self.lfclient_url, ssid=self.ssid, ssid_pass=self.password,
                                         security=self.security, number_template_=self.prefix, mode=0, up=True, dhcp=True,
                                         debug_=False)
     self.cxProfile = realm.new_l3_cx_profile()
示例#9
0
 def __init__(self,
              _ssid=None,
              _security=None,
              _password=None,
              _host=None,
              _port=None,
              _sta_list=None,
              _number_template="00000",
              _radio="wiphy0",
              _proxy_str=None,
              _debug_on=False,
              _exit_on_error=False,
              _exit_on_fail=False):
     super().__init__(_host,
                      _port,
                      _proxy_str=_proxy_str,
                      _local_realm=realm.Realm(
                          lfclient_host=_host,
                          lfclient_port=_port,
                          _exit_on_error=_exit_on_error,
                          _exit_on_fail=_exit_on_fail,
                          _proxy_str=_proxy_str,
                          debug_=_debug_on),
                      _debug=_debug_on,
                      _exit_on_fail=_exit_on_fail)
     self.host = _host
     self.port = _port
     self.ssid = _ssid
     self.security = _security
     self.password = _password
     self.sta_list = _sta_list
     self.radio = _radio
     self.timeout = 120
     self.number_template = _number_template
     self.debug = _debug_on
     self.station_profile = self.local_realm.new_station_profile()
     self.station_profile.lfclient_url = self.lfclient_url
     self.station_profile.ssid = self.ssid
     self.station_profile.ssid_pass = self.password,
     self.station_profile.security = self.security
     self.station_profile.number_template_ = self.number_template
     self.station_profile.mode = 0
     if self.debug:
         print("----- Station List ----- ----- ----- ----- ----- ----- \n")
         pprint.pprint(self.sta_list)
         print("---- ~Station List ----- ----- ----- ----- ----- ----- \n")
    def __init__(self,
                 ssid,
                 security,
                 password,
                 sta_list=None,
                 ap=None,
                 mode=0,
                 number_template="00000",
                 host="localhost",
                 port=8080,
                 radio="wiphy0",
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(host,
                         port,
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        self.host = host
        self.port = port
        self.ssid = ssid
        self.mode = mode
        self.ap = ap
        self.radio = radio
        self.security = security
        self.password = password
        self.sta_list = sta_list
        self.timeout = 120
        self.number_template = number_template
        self.debug = _debug_on
        self.local_realm = realm.Realm(lfclient_host=self.host,
                                       lfclient_port=self.port)
        self.station_profile = self.local_realm.new_station_profile()

        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.ssid_pass = self.password
        self.station_profile.mode = self.mode
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
        self.station_profile.mode = mode
        if self.ap is not None:
            self.station_profile.set_command_param("add_sta", "ap", self.ap)
示例#11
0
def create_class_realms(data):
    """
    the function uses objects from class: server_group.ServerGroup and realm.Realm
    empty_realms represent group of servers, contain uniqe id for the group of servers imported from
    json file connected-realm.json. 
    aslo second (for) loop extract single server with uniqe name.
    """
    # create json file to save represent of class  ?? if it not exist activate this create_class_realms and save it

    for empty_realms in data['results']:

        id = empty_realms['data']['id']
        realms_list = empty_realms['data']['realms']
        href_key = empty_realms['key']['href']

        _realms = sg.ServerGroup()

        _realms.id_group = id
        _realms.list_of_server = realms_list
        _realms.href_key = href_key

        list_class_server.append(_realms)

        to_realm = empty_realms['data']
        for realm in to_realm['realms']:

            name = realm['name']['en_GB']
            realm_id = realm['id']

            realm = r.Realm()

            realm.group_server = _realms
            realm.id_server = id
            realm.ah_json = _realms.ah_json_path
            realm.name_of_realm = name
            realm.realm_id = realm_id

            list_class_realm.append(realm)
示例#12
0
    def __init__(self,
                 host,
                 port,
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):

        super().__init__(host,
                         port,
                         _debug=_debug_on,
                         _exit_on_fail=_exit_on_fail,
                         _local_realm=realm.Realm(lfclient_host=host,
                                                  lfclient_port=port,
                                                  debug_=_debug_on))
        self.host = host
        self.port = port
        self.notes = []
        self.append = []
        self.params = {}
        self.flags = 0x0
        self.flags_mask = 0x0
        self.data = {}
        self.url = "/cli-json/add_dut"
示例#13
0
    def __init__(self,
                 host,
                 port,
                 group_name=None,
                 add_cx_list=[],
                 rm_cx_list=[],
                 tg_action=None,
                 cx_action=None,
                 list_groups=None,
                 show_group=None):

        self.local_realm = realm.Realm(lfclient_host=host, lfclient_port=port)
        self.tg_profile = self.local_realm.new_test_group_profile()
        if group_name is None and list_groups is None and (
                tg_action is not None or cx_action is not None
                or add_cx_list is not None or rm_cx_list is not None
                or show_group is not None):
            raise ValueError(
                "Group name must be set if manipulating test groups")
        else:
            self.tg_profile.group_name = group_name

        self.tg_action = tg_action
        self.cx_action = cx_action
        self.list_groups = list_groups
        self.show_group = show_group
        if add_cx_list is not None and len(
                add_cx_list) == 1 and ',' in add_cx_list[0]:
            self.add_cx_list = add_cx_list[0].split(',')
        else:
            self.add_cx_list = add_cx_list

        if rm_cx_list is not None and len(
                rm_cx_list) == 1 and ',' in rm_cx_list[0]:
            self.rm_cx_list = rm_cx_list[0].split(',')
        else:
            self.rm_cx_list = rm_cx_list
    def __init__(self,
                 host,
                 port,
                 ssid,
                 security,
                 password,
                 sta_list,
                 name_prefix,
                 upstream,
                 radio,
                 side_a_min_rate=56,
                 side_a_max_rate=0,
                 side_b_min_rate=56,
                 side_b_max_rate=0,
                 upstream_subnets="20.20.20.0/24",
                 upstream_nexthop="20.20.20.1",
                 local_subnets="10.40.0.0/24",
                 local_nexthop="10.40.3.198",
                 rdd_ip="20.20.20.20",
                 rdd_gateway="20.20.20.1",
                 rdd_netmask="255.255.255.0",
                 number_template="00000",
                 test_duration="5m",
                 use_ht160=False,
                 vr_name="vr_test",
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(host,
                         port,
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        self.upstream = upstream
        self.host = host
        self.port = port
        self.ssid = ssid
        self.sta_list = sta_list
        self.security = security
        self.password = password
        self.radio = radio
        self.number_template = number_template
        self.debug = _debug_on
        self.name_prefix = name_prefix
        self.test_duration = test_duration
        self.local_realm = realm.Realm(lfclient_host=self.host,
                                       lfclient_port=self.port)
        self.station_profile = self.local_realm.new_station_profile()
        self.cx_profile = self.local_realm.new_l3_cx_profile()
        self.vr_profile = self.local_realm.new_vr_profile()

        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.ssid_pass = self.password
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
        self.station_profile.debug = self.debug
        self.station_profile.use_ht160 = use_ht160
        if self.station_profile.use_ht160:
            self.station_profile.mode = 9

        self.cx_profile.host = self.host
        self.cx_profile.port = self.port
        self.cx_profile.name_prefix = self.name_prefix
        self.cx_profile.side_a_min_bps = side_a_min_rate
        self.cx_profile.side_a_max_bps = side_a_max_rate
        self.cx_profile.side_b_min_bps = side_b_min_rate
        self.cx_profile.side_b_max_bps = side_b_max_rate

        self.vr_profile.vr_name = vr_name
        self.upstream_subnets = upstream_subnets
        self.upstream_nexthop = upstream_nexthop
        self.local_subnets = local_subnets
        self.local_nexthop = local_nexthop
        self.rdd_ip = rdd_ip
        self.rdd_gateway = rdd_gateway
        self.rdd_netmask = rdd_netmask
parser.add_argument(
    '--clean_chambers',
    help=
    'use to cleanup Chambers will be when overwrite is selected, otherwise they will be kept',
    action="store_true")

group.add_argument('--start', help='name of test group to start', default=None)
group.add_argument('--quiesce',
                   help='name of test group to quiesce',
                   default=None)
group.add_argument('--stop', help='name of test group to stop', default=None)
args = parser.parse_args()

local_realm = realm.Realm(lfclient_host=args.mgr,
                          lfclient_port=args.mgr_port,
                          debug_=args.debug)

if args.load is not None:
    data = {
        "name": args.load,
        "action": args.action,
        "clean_dut": "no",
        "clean_chambers": "no"
    }
    if args.clean_dut:
        data['clean_dut'] = "yes"
    if args.clean_chambers:
        data['clean_chambers'] = "yes"
    print("Loading database %s" % args.load)
    local_realm.json_post("/cli-json/load", data)
示例#16
0
    def __init__(self,
                 host,
                 port,
                 ssid,
                 security,
                 password,
                 number_template="00000",
                 radio="wiphy0",
                 fs_type=fe_fstype.EP_FE_NFS4.name,
                 min_rw_size=64 * 1024,
                 max_rw_size=64 * 1024,
                 min_file_size=25 * 1024 * 1024,
                 max_file_size=25 * 1024 * 1024,
                 min_read_rate_bps=1000 * 1000,
                 max_read_rate_bps=1000 * 1000,
                 min_write_rate_bps="1G",
                 max_write_rate_bps=1000 * 1000,
                 directory="AUTO",
                 test_duration="5m",
                 upstream_port="eth1",
                 num_ports=1,
                 server_mount="10.40.0.1:/var/tmp/test",
                 macvlan_parent=None,
                 first_mvlan_ip=None,
                 netmask=None,
                 gateway=None,
                 dhcp=True,
                 use_macvlans=False,
                 use_test_groups=False,
                 write_only_test_group=None,
                 read_only_test_group=None,
                 port_list=[],
                 ip_list=None,
                 mode="both",
                 update_group_args={
                     "name": None,
                     "action": None,
                     "cxs": None
                 },
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(host,
                         port,
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        self.host = host
        self.port = port
        self.radio = radio
        self.upstream_port = upstream_port
        self.ssid = ssid
        self.security = security
        self.password = password
        self.number_template = number_template
        self.test_duration = test_duration
        self.port_list = []
        self.use_macvlans = use_macvlans
        self.mode = mode.lower()
        self.ip_list = ip_list
        self.netmask = netmask
        self.gateway = gateway
        if self.use_macvlans:
            if macvlan_parent is not None:
                self.macvlan_parent = macvlan_parent
                self.port_list = port_list
        else:
            self.port_list = port_list

        self.use_test_groups = use_test_groups
        if self.use_test_groups:
            if self.mode == "write":
                if write_only_test_group is not None:
                    self.write_only_test_group = write_only_test_group
                else:
                    raise ValueError(
                        "--write_only_test_group must be used to set test group name"
                    )
            if self.mode == "read":
                if read_only_test_group is not None:
                    self.read_only_test_group = read_only_test_group
                else:
                    raise ValueError(
                        "--read_only_test_group must be used to set test group name"
                    )
            if self.mode == "both":
                if write_only_test_group is not None and read_only_test_group is not None:
                    self.write_only_test_group = write_only_test_group
                    self.read_only_test_group = read_only_test_group
                else:
                    raise ValueError(
                        "--write_only_test_group and --read_only_test_group "
                        "must be used to set test group names")

        #self.min_rw_size = self.parse_size(min_rw_size)
        #self.max_rw_size = self.parse_size(max_rw_size)
        #self.min_file_size = self.parse_size(min_file_size)
        #self.min_file_size = self.parse_size(min_file_size)
        #self.min_read_rate_bps = self.parse_size_bps(min_read_rate_bps)
        # self.max_read_rate_bps = self.sisize_bps(max_read_rate_bps)
        # self.min_write_rate_bps = self.parse_size_bps(min_write_rate_bps)
        #self.max_write_rate_bps = self.parse_size_bps(max_write_rate_bps)

        self.local_realm = realm.Realm(lfclient_host=self.host,
                                       lfclient_port=self.port)
        self.wo_profile = self.local_realm.new_fio_endp_profile()
        self.mvlan_profile = self.local_realm.new_mvlan_profile()

        if not self.use_macvlans and len(self.port_list) > 0:
            self.station_profile = self.local_realm.new_station_profile()
            self.station_profile.lfclient_url = self.lfclient_url
            self.station_profile.ssid = self.ssid
            self.station_profile.ssid_pass = self.password
            self.station_profile.security = self.security
            self.station_profile.number_template_ = self.number_template
            self.station_profile.mode = 0

        self.wo_profile.fs_type = fs_type
        self.wo_profile.min_rw_size = LFUtils.parse_size(min_rw_size)
        self.wo_profile.max_rw_size = LFUtils.parse_size(max_rw_size)
        self.wo_profile.min_file_size = LFUtils.parse_size(min_file_size)
        self.wo_profile.max_file_size = LFUtils.parse_size(max_file_size)
        self.wo_profile.min_read_rate_bps = LFUtils.parse_size(
            min_read_rate_bps)
        self.wo_profile.max_read_rate_bps = LFUtils.parse_size(
            max_read_rate_bps)
        self.wo_profile.min_write_rate_bps = LFUtils.parse_size(
            min_write_rate_bps)
        self.wo_profile.max_write_rate_bps = LFUtils.parse_size(
            max_write_rate_bps)
        self.wo_profile.directory = directory
        self.wo_profile.server_mount = server_mount

        self.ro_profile = self.wo_profile.create_ro_profile()

        if self.use_macvlans:
            self.mvlan_profile.num_macvlans = int(num_ports)
            self.mvlan_profile.desired_macvlans = self.port_list
            self.mvlan_profile.macvlan_parent = self.macvlan_parent
            self.mvlan_profile.dhcp = dhcp
            self.mvlan_profile.netmask = netmask
            self.mvlan_profile.first_ip_addr = first_mvlan_ip
            self.mvlan_profile.gateway = gateway

        self.created_ports = []
        if self.use_test_groups:
            if self.mode is not None:
                if self.mode == "write":
                    self.wo_tg_profile = self.local_realm.new_test_group_profile(
                    )
                    self.wo_tg_profile.group_name = self.write_only_test_group
                elif self.mode == "read":
                    self.ro_tg_profile = self.local_realm.new_test_group_profile(
                    )
                    self.ro_tg_profile.group_name = self.read_only_test_group
                elif self.mode == "both":
                    self.wo_tg_profile = self.local_realm.new_test_group_profile(
                    )
                    self.ro_tg_profile = self.local_realm.new_test_group_profile(
                    )
                    self.wo_tg_profile.group_name = self.write_only_test_group
                    self.ro_tg_profile.group_name = self.read_only_test_group
                else:
                    raise ValueError("Unknown mode given ", self.mode)
            else:
                raise ValueError(
                    "Mode ( read, write, or both ) must be specified")

        if update_group_args is not None and update_group_args[
                'name'] is not None:
            temp_tg = self.local_realm.new_test_group_profile()
            temp_cxs = update_group_args['cxs'].split(',')
            if update_group_args['action'] == "add":
                temp_tg.group_name = update_group_args['name']
                if not temp_tg.check_group_exists():
                    temp_tg.create_group()
                for cx in temp_cxs:
                    if "CX_" not in cx:
                        cx = "CX_" + cx
                    temp_tg.add_cx(cx)
            if update_group_args['action'] == "del":
                temp_tg.group_name = update_group_args['name']
                if temp_tg.check_group_exists():
                    for cx in temp_cxs:
                        temp_tg.rm_cx(cx)
            time.sleep(5)

        self.wo_tg_exists = False
        self.ro_tg_exists = False
        self.wo_tg_cx_exists = False
        self.ro_tg_cx_exists = False
        print("Checking for pre-existing test groups and cxs")
        if self.use_test_groups:
            if self.mode == "write":
                if self.wo_tg_profile.check_group_exists():
                    self.wo_tg_exists = True
                    if len(self.wo_tg_profile.list_cxs()) > 0:
                        self.wo_tg_cx_exists = True
            elif self.mode == "read":
                if self.ro_tg_profile.check_group_exists():
                    self.ro_tg_exists = True
                    if len(self.ro_tg_profile.list_cxs()) > 0:
                        self.ro_tg_cx_exists = True
            elif self.mode == "both":
                if self.wo_tg_profile.check_group_exists():
                    self.wo_tg_exists = True
                    if len(self.wo_tg_profile.list_cxs()) > 0:
                        self.wo_tg_cx_exists = True
                if self.ro_tg_profile.check_group_exists():
                    self.ro_tg_exists = True
                    if len(self.ro_tg_profile.list_cxs()) > 0:
                        self.ro_tg_cx_exists = True
示例#17
0
    def __init__(self,
                 lfclient_host="localhost",
                 lfclient_port=8080,
                 radio="wiphy1",
                 sta_prefix="sta",
                 start_id=0,
                 num_sta=2,
                 dut_ssid="lexusdut",
                 dut_security="open",
                 dut_passwd="[BLANK]",
                 upstream="eth1",
                 name_prefix="L3Test",
                 session_id="Layer3Test",
                 test_name="Client/s Connectivity Test",
                 pass_criteria=20,
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(lfclient_host,
                         lfclient_port,
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        print("Test is about to start")
        self.host = lfclient_host
        self.port = lfclient_port
        self.radio = radio
        self.upstream = upstream
        self.monitor_interval = 1
        self.sta_prefix = sta_prefix
        self.sta_start_id = start_id
        self.pass_criteria = pass_criteria
        self.num_sta = num_sta
        self.name_prefix = name_prefix
        self.ssid = dut_ssid
        self.security = dut_security
        self.password = dut_passwd
        self.session_id = session_id
        self.test_name = test_name
        self.test_duration = 1

        self.local_realm = realm.Realm(lfclient_host=self.host,
                                       lfclient_port=self.port)
        self.station_profile = self.local_realm.new_station_profile()

        station_list = []
        for i in range(0, self.num_sta):
            station_list.append(self.sta_prefix + str(i).zfill(4))
        print(station_list)
        self.station_data = dict.fromkeys(station_list)
        for i in station_list:
            self.station_data[i] = "None"
        print(self.station_data)

        self.reports_path = webconsole_dir + "/reports/" + self.test_name + "_" + self.session_id + '/'

        print(self.reports_path)

        if not os.path.exists(self.reports_path):
            os.makedirs(self.reports_path)
        print("Test is Initialized")
        self.station_list = LFUtils.portNameSeries(prefix_=self.sta_prefix,
                                                   start_id_=self.sta_start_id,
                                                   end_id_=self.num_sta - 1,
                                                   padding_number_=10000,
                                                   radio=self.radio)
        print(self.station_profile.station_names)
示例#18
0
 def __init__(self,
              host,
              port,
              security=None,
              ssid=None,
              sta_list=None,
              number_template="00000",
              _debug_on=False,
              _dut_bssid="",
              _exit_on_error=False,
              _sta_name=None,
              _resource=1,
              radio="wiphy0",
              key_mgmt="WPA-EAP",
              eap="",
              identity="",
              ttls_passwd="",
              hessid=None,
              ttls_realm="",
              domain="",
              _sta_prefix='eap',
              _exit_on_fail=False,
              _cleanup_on_exit=True):
     super().__init__(host,
                      port,
                      _debug=_debug_on,
                      _halt_on_error=_exit_on_error,
                      _exit_on_fail=_exit_on_fail)
     self.host = host
     self.port = port
     self.ssid = ssid
     self.radio = radio
     self.security = security
     #self.password = password
     self.sta_list = sta_list
     self.key_mgmt = key_mgmt
     self.eap = eap
     self.sta_prefix = _sta_prefix
     self.identity = identity
     self.ttls_passwd = ttls_passwd
     self.ttls_realm = ttls_realm
     self.domain = domain
     self.hessid = hessid
     self.dut_bssid = _dut_bssid
     self.timeout = 120
     self.number_template = number_template
     self.debug = _debug_on
     self.local_realm = realm.Realm(lfclient_host=self.host,
                                    lfclient_port=self.port)
     self.station_profile = self.local_realm.new_station_profile()
     self.station_profile.lfclient_url = self.lfclient_url
     self.station_profile.ssid = self.ssid
     self.station_profile.security = self.security
     self.station_profile.number_template_ = self.number_template
     self.station_profile.mode = 0
     #Added to test_ipv4_ttls code
     self.upstream_url = None  # defer construction
     self.sta_url_map = None
     self.upstream_resource = None
     self.upstream_port = "eth2"
     self.station_names = []
     if _sta_name is not None:
         self.station_names = [_sta_name]
     self.localrealm = Realm(lfclient_host=host, lfclient_port=port)
     self.resource = _resource
     self.cleanup_on_exit = _cleanup_on_exit
     self.resulting_stations = {}
     self.resulting_endpoints = {}
     self.station_profile = None
     self.l3_udp_profile = None
     self.l3_tcp_profile = None
示例#19
0
import math as mt
import numpy as np
import random as rd
import engine as eg
import cylax as cl
import sys
import config as cf

sys.path.insert(1, 'C:/Users/Frank/Desktop/Cylax/PySystem/Characters')

import character_sheet as char
import realm as re
#
world = re.Realm()


class Teeth_Change:
    def __init__(self, character):
        while "Weak Bite" in character.Traits:
            num_i = 0.5
        else:
            num_i = 1
        self.Result = num_i


class Force:
    def __init__(self, num_i):
        self.Force = num_i
        self.Knockback = num_i
        self.Knockup = num_i
        self.Push = num_i
    def __init__(self,
                 host,
                 port,
                 ssid,
                 security,
                 password,
                 number_template="00000",
                 radio="wiphy0",
                 fs_type=fe_fstype.EP_FE_NFS4.name,
                 min_rw_size=64 * 1024,
                 max_rw_size=64 * 1024,
                 min_file_size=25 * 1024 * 1024,
                 max_file_size=25 * 1024 * 1024,
                 min_read_rate_bps=1000 * 1000,
                 max_read_rate_bps=1000 * 1000,
                 min_write_rate_bps="1G",
                 max_write_rate_bps=1000 * 1000,
                 directory="AUTO",
                 test_duration="5m",
                 upstream_port="eth1",
                 num_ports=1,
                 server_mount="10.40.0.1:/var/tmp/test",
                 macvlan_parent=None,
                 first_mvlan_ip=None,
                 netmask=None,
                 gateway=None,
                 dhcp=True,
                 use_macvlans=False,
                 use_test_groups=False,
                 write_only_test_group=None,
                 read_only_test_group=None,
                 port_list=[],
                 ip_list=None,
                 mode=None,
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(host,
                         port,
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        self.host = host
        self.port = port
        self.radio = radio
        self.upstream_port = upstream_port
        self.ssid = ssid
        self.security = security
        self.password = password
        self.number_template = number_template
        self.test_duration = test_duration
        self.port_list = []
        self.use_macvlans = use_macvlans
        self.mode = mode
        self.ip_list = ip_list
        self.netmask = netmask
        self.gateway = gateway
        if self.use_macvlans:
            if macvlan_parent is not None:
                self.macvlan_parent = macvlan_parent
                self.port_list = port_list
        else:
            self.port_list = port_list

        self.use_test_groups = use_test_groups
        if self.use_test_groups:
            if self.mode == "write":
                if write_only_test_group is not None:
                    self.write_only_test_group = write_only_test_group
                else:
                    raise ValueError(
                        "--write_only_test_group must be used to set test group name"
                    )
            if self.mode == "read":
                if read_only_test_group is not None:
                    self.read_only_test_group = read_only_test_group
                else:
                    raise ValueError(
                        "--read_only_test_group must be used to set test group name"
                    )
            if self.mode == "both":
                if write_only_test_group is not None and read_only_test_group is not None:
                    self.write_only_test_group = write_only_test_group
                    self.read_only_test_group = read_only_test_group
                else:
                    raise ValueError(
                        "--write_only_test_group and --read_only_test_group "
                        "must be used to set test group names")

        #self.min_rw_size = self.parse_size(min_rw_size)
        #self.max_rw_size = self.parse_size(max_rw_size)
        #self.min_file_size = self.parse_size(min_file_size)
        #self.min_file_size = self.parse_size(min_file_size)
        #self.min_read_rate_bps = self.parse_size_bps(min_read_rate_bps)
        #self.max_read_rate_bps = self.parse_size_bps(max_read_rate_bps)
        #self.min_write_rate_bps = self.parse_size_bps(min_write_rate_bps)
        #self.max_write_rate_bps = self.parse_size_bps(max_write_rate_bps)

        self.local_realm = realm.Realm(lfclient_host=self.host,
                                       lfclient_port=self.port)
        self.wo_profile = self.local_realm.new_fio_endp_profile()
        self.mvlan_profile = self.local_realm.new_mvlan_profile()

        if not self.use_macvlans and len(self.port_list) > 0:
            self.station_profile = self.local_realm.new_station_profile()
            self.station_profile.lfclient_url = self.lfclient_url
            self.station_profile.ssid = self.ssid
            self.station_profile.ssid_pass = self.password
            self.station_profile.security = self.security
            self.station_profile.number_template_ = self.number_template
            self.station_profile.mode = 0

        self.wo_profile.fs_type = fs_type
        self.wo_profile.min_rw_size = LFUtils.parse_size(min_rw_size)
        self.wo_profile.max_rw_size = LFUtils.parse_size(max_rw_size)
        self.wo_profile.min_file_size = LFUtils.parse_size(min_file_size)
        self.wo_profile.max_file_size = LFUtils.parse_size(max_file_size)
        self.wo_profile.min_read_rate_bps = LFUtils.parse_size(
            min_read_rate_bps)
        self.wo_profile.max_read_rate_bps = LFUtils.parse_size(
            max_read_rate_bps)
        self.wo_profile.min_write_rate_bps = LFUtils.parse_size(
            min_write_rate_bps)
        self.wo_profile.max_write_rate_bps = LFUtils.parse_size(
            max_write_rate_bps)
        self.wo_profile.directory = directory
        self.wo_profile.server_mount = server_mount

        self.ro_profile = self.wo_profile.create_ro_profile()

        if self.use_macvlans:
            self.mvlan_profile.num_macvlans = int(num_ports)
            self.mvlan_profile.desired_macvlans = self.port_list
            self.mvlan_profile.macvlan_parent = self.macvlan_parent
            self.mvlan_profile.dhcp = dhcp
            self.mvlan_profile.netmask = netmask
            self.mvlan_profile.first_ip_addr = first_mvlan_ip
            self.mvlan_profile.gateway = gateway

        self.created_ports = []
        if self.use_test_groups:
            if self.mode is not None:
                if self.mode.lower() == "write":
                    self.wo_tg_profile = self.local_realm.new_test_group_profile(
                    )
                elif self.mode.lower() == "read":
                    self.ro_tg_profile = self.local_realm.new_test_group_profile(
                    )
                elif self.mode.lower() == "both":
                    self.wo_tg_profile = self.local_realm.new_test_group_profile(
                    )
                    self.ro_tg_profile = self.local_realm.new_test_group_profile(
                    )
                else:
                    raise ValueError("Unknown mode given ", self.mode)
            else:
                raise ValueError("Mode (read,write,both) must be specified")
示例#21
0
    def __init__(self,
                 host,
                 port,
                 ssid,
                 security,
                 password,
                 station_list,
                 number_template="00000",
                 radio="wiphy0",
                 fs_type=fe_fstype.EP_FE_NFS4.name,
                 min_rw_size=64 * 1024,
                 max_rw_size=64 * 1024,
                 min_file_size=25 * 1024 * 1024,
                 max_file_size=25 * 1024 * 1024,
                 min_read_rate_bps=1000 * 1000,
                 max_read_rate_bps=1000 * 1000,
                 min_write_rate_bps="1G",
                 max_write_rate_bps=1000 * 1000,
                 directory="AUTO",
                 test_duration="5m",
                 upstream_port="eth1",
                 num_macvlans=1,
                 server_mount="10.40.0.1:/var/tmp/test",
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(host,
                         port,
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        self.host = host
        self.port = port
        self.radio = radio
        self.upstream_port = upstream_port
        self.ssid = ssid
        self.security = security
        self.password = password
        self.number_template = number_template
        self.sta_list = station_list
        self.test_duration = test_duration
        #self.min_rw_size = self.parse_size(min_rw_size)
        #self.max_rw_size = self.parse_size(max_rw_size)
        #self.min_file_size = self.parse_size(min_file_size)
        #self.min_file_size = self.parse_size(min_file_size)
        #self.min_read_rate_bps = self.parse_size_bps(min_read_rate_bps)
        #self.max_read_rate_bps = self.parse_size_bps(max_read_rate_bps)
        #self.min_write_rate_bps = self.parse_size_bps(min_write_rate_bps)
        #self.max_write_rate_bps = self.parse_size_bps(max_write_rate_bps)

        self.local_realm = realm.Realm(lfclient_host=self.host,
                                       lfclient_port=self.port)
        self.station_profile = self.local_realm.new_station_profile()
        self.endp_profile = self.local_realm.new_fio_endp_profile()
        self.mvlan_profile = self.local_realm.new_mvlan_profile()

        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.ssid_pass = self.password
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
        self.station_profile.mode = 0

        self.endp_profile.fs_type = fs_type
        self.endp_profile.min_rw_size = LFUtils.parse_size(min_rw_size)
        self.endp_profile.max_rw_size = LFUtils.parse_size(max_rw_size)
        self.endp_profile.min_file_size = LFUtils.parse_size(min_file_size)
        self.endp_profile.min_file_size = LFUtils.parse_size(min_file_size)
        self.endp_profile.min_read_rate_bps = LFUtils.parse_size(
            min_read_rate_bps)
        self.endp_profile.max_read_rate_bps = LFUtils.parse_size(
            max_read_rate_bps)
        self.endp_profile.min_write_rate_bps = LFUtils.parse_size(
            min_write_rate_bps)
        self.endp_profile.max_write_rate_bps = LFUtils.parse_size(
            max_write_rate_bps)
        self.endp_profile.directory = directory
        self.endp_profile.server_mount = server_mount

        self.ro_profile = self.endp_profile.create_ro_profile()

        self.mvlan_profile.num_macvlans = int(num_macvlans)
        self.mvlan_profile.upstream_port = upstream_port
示例#22
0
    def __init__(self,
                 host,
                 port,
                 ssid,
                 security,
                 password,
                 station_list,
                 side_a_min_rate=56,
                 side_b_min_rate=56,
                 side_a_max_rate=0,
                 side_b_max_rate=0,
                 pdu_size=1000,
                 prefix="00000",
                 test_duration="5m",
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(host,
                         port,
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        self.host = host
        self.port = port
        self.ssid = ssid
        self.security = security
        self.password = password
        self.sta_list = station_list
        self.prefix = prefix
        self.debug = _debug_on
        self.local_realm = realm.Realm(lfclient_host=self.host,
                                       lfclient_port=self.port,
                                       debug_=False,
                                       halt_on_error_=True)
        # upload
        self.cx_prof_upload = realm.L3CXProfile(self.host,
                                                self.port,
                                                self.local_realm,
                                                side_a_min_bps=side_a_min_rate,
                                                side_b_min_bps=0,
                                                side_a_max_bps=side_a_max_rate,
                                                side_b_max_bps=0,
                                                side_a_min_pdu=pdu_size,
                                                side_a_max_pdu=pdu_size,
                                                side_b_min_pdu=0,
                                                side_b_max_pdu=0,
                                                debug_=False)

        # download
        self.cx_prof_download = realm.L3CXProfile(
            self.host,
            self.port,
            self.local_realm,
            side_a_min_bps=0,
            side_b_min_bps=side_b_min_rate,
            side_a_max_bps=0,
            side_b_max_bps=side_b_max_rate,
            side_a_min_pdu=0,
            side_a_max_pdu=0,
            side_b_min_pdu=pdu_size,
            side_b_max_pdu=pdu_size,
            debug_=False)
        self.test_duration = test_duration
        self.station_profile = realm.StationProfile(
            self.lfclient_url,
            self.local_realm,
            ssid=self.ssid,
            ssid_pass=self.password,
            security=self.security,
            number_template_=self.prefix,
            mode=0,
            up=True,
            dhcp=True,
            debug_=False)
        self.new_monitor = realm.WifiMonitor(self.lfclient_url,
                                             self.local_realm,
                                             debug_=_debug_on)
示例#23
0
        if (self.ethport == '-1'):
            result.Fail('Could not resolve realm ethport')

        try:
            ip = socket.gethostbyname(self.ipaddr)
        except socket.gaierror, exc:
            errno, errstr = exc
            result.Annotate({'Realm name' : self.property,
                             'Realm RSA' : self.ipaddr,
                             'Exception' : str(exc)})
            result.Fail('Could not resolve realm RSA IP address')
        else:
            self.ipaddr = ip
            _realm = realm.Realm(self.ipaddr, self.mask, self.ethport,
                                 self.property, self.type, self.sigpool,
                                 self.medpool)
            context[self.property] = _realm

class Dmalloc_Env(Resource):
    """
    Resource for initializing and maintaining values specific to individual 
    dmalloc testing environments.

    This resource contains attributes necessary to:
        1) Communicate via SSH to and from the MSW and Call Generator
        2) Locate supporting source code (scripts) for dmalloc testing
        3) Locate special dmalloc gis builds for dmalloc testing
        4) Locate MSW and Call Generator temp working direcries
        5) Maintain current the test suite name during test execution
    """
示例#24
0
    def __init__(self,
                 _host="localhost",
                 _port=8080,
                 _ssid=None,
                 _security=None,
                 _password=None,
                 _sta_list=None,
                 _name_prefix="sta",
                 _upstream="1.1.eth1",
                 _radio="wiphy0",
                 _side_a_min_rate=256000,
                 _side_a_max_rate=0, # same
                 _side_b_min_rate=256000,
                 _side_b_max_rate=0, # same
                 _number_template="00000",
                 _test_duration="5m",
                 _use_ht160=False,
                 _cx_type=None,
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(_host,
                         _port,
                         _local_realm=realm.Realm(lfclient_host=_host,
                                                  lfclient_port=_port,
                                                  debug_=_debug_on,
                                                  _exit_on_error=_exit_on_error,
                                                  _exit_on_fail=_exit_on_fail),
                         _debug=_debug_on,
                         _exit_on_fail=_exit_on_fail)
        self.upstream = _upstream
        self.ssid = _ssid
        self.sta_list = _sta_list
        self.security = _security
        self.password = _password
        self.radio = _radio
        self.number_template = _number_template
        self.debug = _debug_on
        self.name_prefix = _name_prefix
        self.test_duration = _test_duration
        self.cx_type = _cx_type

        self.station_profile = self.local_realm.new_station_profile()
        self.cx_profile = self.local_realm.new_l3_cx_profile()

        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.ssid_pass = self.password
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
        self.station_profile.debug = self.debug
        self.station_profile.use_ht160 = _use_ht160
        if self.station_profile.use_ht160:
            self.station_profile.mode = 9

        self.cx_profile.host = _host
        self.cx_profile.port = _port
        self.cx_profile.name_prefix = _name_prefix
        self.cx_profile.side_a_min_bps = _side_a_min_rate
        self.cx_profile.side_a_max_bps = _side_a_max_rate
        self.cx_profile.side_b_min_bps = _side_b_min_rate
        self.cx_profile.side_b_max_bps = _side_b_max_rate
示例#25
0
import math as mt
import numpy as np
import random as rd
import engine as eg
import physics as ph
import cylax as cl
import realm as re


class Main:
    def __init__(self, debug):

        self.DebugMode = debug  ### 0 = off, 1 = on


Debug = Main(1)
Debug.__init__(1)

world_gravity = re.Realm()
示例#26
0
    def __init__(self,
                 host,
                 port,
                 ssid="[BLANK]",
                 security="wpa2",
                 password="******",
                 radio="wiphy0",
                 key_mgmt="WPA-EAP",
                 pairwise="NA",
                 group="NA",
                 wpa_psk="DEFAULT",
                 wep_key="NA",
                 ca_cert="NA",
                 eap="TTLS",
                 identity="testuser",
                 anonymous_identity="NA",
                 phase1="NA",
                 phase2="NA",
                 ttls_passwd="testpasswd",
                 pin="NA",
                 pac_file="NA",
                 private_key="NA",
                 pk_passwd="NA",
                 hessid="00:00:00:00:00:01",
                 ttls_realm="localhost.localdomain",
                 client_cert="NA",
                 imsi="NA",
                 milenage="NA",
                 domain="localhost.localdomain",
                 roaming_consortium="NA",
                 venue_group="NA",
                 network_type="NA",
                 ipaddr_type_avail="NA",
                 network_auth_type="NA",
                 anqp_3gpp_cell_net="NA",
                 ieee80211w=1,
                 hs20_enable=False,
                 enable_pkc=False,
                 number_template="00000",
                 sta_list=None,
                 _debug_on=False,
                 _exit_on_error=False,
                 _exit_on_fail=False):
        super().__init__(host,
                         port,
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        self.host = host
        self.port = port
        self.ssid = ssid
        self.radio = radio
        self.security = security
        self.password = password
        self.sta_list = sta_list

        self.key_mgmt = key_mgmt
        self.pairwise = pairwise
        self.group = group

        self.wpa_psk = wpa_psk
        self.key = wep_key
        self.ca_cert = ca_cert
        self.eap = eap
        self.identity = identity  # eap identity
        self.anonymous_identity = anonymous_identity
        self.phase1 = phase1
        self.phase2 = phase2
        self.ttls_passwd = ttls_passwd  #eap passwd
        self.pin = pin
        self.pac_file = pac_file
        self.private_key = private_key
        self.pk_passwd = pk_passwd
        self.hessid = hessid
        self.ttls_realm = ttls_realm
        self.client_cert = client_cert
        self.imsi = imsi
        self.milenage = milenage
        self.domain = domain
        self.roaming_consortium = roaming_consortium
        self.venue_group = venue_group
        self.network_type = network_type
        self.ipaddr_type_avail = ipaddr_type_avail
        self.network_auth_type = network_auth_type
        self.anqp_3gpp_cell_net = anqp_3gpp_cell_net

        self.ieee80211w = ieee80211w
        self.hs20_enable = hs20_enable
        self.enable_pkc = enable_pkc

        self.timeout = 120
        self.number_template = number_template
        self.debug = _debug_on
        self.local_realm = realm.Realm(lfclient_host=self.host,
                                       lfclient_port=self.port)
        self.station_profile = self.local_realm.new_station_profile()
        self.vap_profile = self.local_realm.new_vap_profile()
        self.vap_profile.vap_name = "TestNet"

        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
        self.station_profile.mode = 0
示例#27
0
    def __init__(self,
                 host,
                 port,
                 ssid=None,
                 security="open",
                 password="******",
                 resource_=1,
                 channel_=0,
                 normal_station_list_=None,
                 normal_station_radio_=None,
                 powersave_station_list_=None,
                 powersave_station_radio_=None,
                 monitor_name_=None,
                 monitor_radio_=None,
                 side_a_min_rate_=56000,
                 side_b_min_rate_=56000,
                 side_a_max_rate_=0,
                 side_b_max_rate_=0,
                 pdu_size_=1000,
                 traffic_duration_="5s",
                 pause_duration_="2s",
                 debug_on_=False,
                 exit_on_error_=False,
                 exit_on_fail_=False):
        super().__init__(host,
                         port,
                         _debug=debug_on_,
                         _halt_on_error=exit_on_error_,
                         _exit_on_fail=exit_on_fail_)
        self.resource = resource_
        if (channel_ == 0):
            raise ValueError("Please set your radio channel")
        self.channel = channel_
        self.monitor_name = monitor_name_
        self.monitor_radio = monitor_radio_
        self.host = host
        self.port = port
        self.ssid = ssid
        self.security = security
        self.password = password
        self.normal_sta_list = normal_station_list_
        self.normal_sta_radio = normal_station_radio_
        self.powersave_sta_list = powersave_station_list_
        self.powersave_sta_radio = powersave_station_radio_
        self.sta_mac_map = {}
        self.debug = debug_on_
        self.packet_filter = realm.PacketFilter()
        self.local_realm = realm.Realm(lfclient_host=self.host,
                                       lfclient_port=self.port,
                                       debug_=self.debug,
                                       halt_on_error_=self.exit_on_error)

        # background traffic
        self.cx_prof_bg = self.local_realm.new_l3_cx_profile()
        self.cx_prof_bg.side_a_min_bps = side_a_min_rate_
        self.cx_prof_bg.side_b_min_bps = side_a_min_rate_
        self.cx_prof_bg.side_a_max_bps = side_a_max_rate_
        self.cx_prof_bg.side_b_max_bps = side_a_min_rate_

        #upload
        self.cx_prof_upload = self.local_realm.new_l3_cx_profile()
        self.cx_prof_upload.side_a_min_bps = side_a_min_rate_
        self.cx_prof_upload.side_b_min_bps = 0
        self.cx_prof_upload.side_a_max_bps = side_a_max_rate_
        self.cx_prof_upload.side_b_max_bps = 0

        self.cx_prof_upload.side_a_min_pdu = pdu_size_
        self.cx_prof_upload.side_a_max_pdu = 0
        self.cx_prof_upload.side_b_min_pdu = pdu_size_
        self.cx_prof_upload.side_b_max_pdu = 0,

        #download
        self.cx_prof_download = self.local_realm.new_l3_cx_profile()
        self.cx_prof_download.side_a_min_bps = 0
        self.cx_prof_download.side_b_min_bps = side_b_min_rate_
        self.cx_prof_download.side_a_max_bps = 0
        self.cx_prof_download.side_b_max_bps = side_b_max_rate_

        self.cx_prof_download.side_a_min_pdu = pdu_size_
        self.cx_prof_download.side_a_max_pdu = 0
        self.cx_prof_download.side_b_min_pdu = pdu_size_
        self.cx_prof_download.side_b_max_pdu = 0

        self.pcap_file = None
        self.test_duration = traffic_duration_
        if isinstance(self.test_duration, int):
            self.test_duration = "%s" % traffic_duration_
        if isinstance(self.test_duration, str):
            self.test_duration = self.local_realm.parse_time(
                self.test_duration)

        self.pause_duration = pause_duration_
        if isinstance(self.pause_duration, int):
            self.pause_duration = "%s" % pause_duration_
        if isinstance(self.pause_duration, str):
            self.pause_duration = self.local_realm.parse_time(
                self.pause_duration)

        self.sta_powersave_enabled_profile = self.local_realm.new_station_profile(
        )
        self.sta_powersave_disabled_profile = self.local_realm.new_station_profile(
        )
        self.wifi_monitor_profile = self.local_realm.new_wifi_monitor_profile()

        self.pcap_save_path = "/home/lanforge/lf_reports"
示例#28
0
    def __init__(
        self,
        ssid,
        security,
        passwd,
        sta_list,
        client,
        name_prefix,
        upstream,
        host="localhost",
        port=8080,
        number_template="000",
        test_duration="5m",
        type="lfping",
        dest=None,
        cmd=None,
        interval=1,
        radio=None,
        speedtest_min_up=None,
        speedtest_min_dl=None,
        speedtest_max_ping=None,
        _debug_on=False,
        _exit_on_error=False,
        _exit_on_fail=False,
    ):
        super().__init__(host,
                         port,
                         _local_realm=realm.Realm(host, port),
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        self.ssid = ssid
        self.radio = radio
        self.upstream = upstream
        self.sta_list = sta_list
        self.security = security
        self.passwd = passwd
        self.number_template = number_template
        self.name_prefix = name_prefix
        self.test_duration = test_duration
        if (speedtest_min_up is not None):
            self.speedtest_min_up = float(speedtest_min_up)
        if (speedtest_min_dl is not None):
            self.speedtest_min_dl = float(speedtest_min_dl)
        if (speedtest_max_ping is not None):
            self.speedtest_max_ping = float(speedtest_max_ping)
        self.debug = _debug_on
        if (client is not None):
            self.client_name = client
        self.station_profile = self.local_realm.new_station_profile()
        self.generic_endps_profile = self.local_realm.new_generic_endp_profile(
        )

        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.ssid_pass = self.passwd,
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
        self.station_profile.mode = 0

        self.generic_endps_profile.name = name_prefix
        self.generic_endps_profile.type = type
        self.generic_endps_profile.dest = dest
        self.generic_endps_profile.cmd = cmd
        self.generic_endps_profile.interval = interval
示例#29
0
    def __init__(
            self,
            ssid,
            security,
            password,
            sta_list,
            name_prefix,
            upstream,
            radio,
            host="localhost",
            port=8080,
            mode=0,
            ap=None,
            side_a_min_rate=56000,
            side_a_max_rate=0,  # indicates 'same'
            side_b_min_rate=56000,
            side_b_max_rate=0,  # indicates 'same'
            number_template="00000",
            test_duration="5m",
            use_ht160=False,
            _debug_on=False,
            _exit_on_error=False,
            _exit_on_fail=False):
        super().__init__(host,
                         port,
                         _local_realm=realm.Realm(
                             lfclient_host=host,
                             lfclient_port=port,
                             debug_=_debug_on,
                             halt_on_error_=_exit_on_error),
                         _debug=_debug_on,
                         _halt_on_error=_exit_on_error,
                         _exit_on_fail=_exit_on_fail)
        self.upstream = upstream
        self.host = host
        self.port = port
        self.ssid = ssid
        self.sta_list = sta_list
        self.security = security
        self.password = password
        self.radio = radio
        self.mode = mode
        self.ap = ap
        self.number_template = number_template
        self.debug = _debug_on
        self.name_prefix = name_prefix
        self.test_duration = test_duration
        self.station_profile = self.local_realm.new_station_profile()
        self.cx_profile = self.local_realm.new_l3_cx_profile()
        self.station_profile.lfclient_url = self.lfclient_url
        self.station_profile.ssid = self.ssid
        self.station_profile.ssid_pass = self.password
        self.station_profile.security = self.security
        self.station_profile.number_template_ = self.number_template
        self.station_profile.debug = self.debug
        self.station_profile.use_ht160 = use_ht160
        if self.station_profile.use_ht160:
            self.station_profile.mode = 9
        if mode is not None:
            self.station_profile.mode = mode
        if self.ap is not None:
            self.station_profile.set_command_param("add_sta", "ap", self.ap)

        self.cx_profile.host = self.host
        self.cx_profile.port = self.port
        self.cx_profile.name_prefix = self.name_prefix
        self.cx_profile.side_a_min_bps = side_a_min_rate
        self.cx_profile.side_a_max_bps = side_a_max_rate
        self.cx_profile.side_b_min_bps = side_b_min_rate
        self.cx_profile.side_b_max_bps = side_b_max_rate