def setUpClass(cls): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures. """ super(InOutTest, cls).setUpClass() inout.get_virtual_iface_mac = mocked_get_virtual_iface_mac warnings.simplefilter('ignore') cls.service_manager = create_service_manager([]) BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE) BridgeTools.create_internal_iface( cls.BRIDGE, cls.MTR_PORT, None, ) mtr_port_no = BridgeTools.get_ofport(cls.MTR_PORT) inout_controller_reference = Future() testing_controller_reference = Future() test_setup = TestSetup( apps=[ PipelinedController.InOut, PipelinedController.Testing, PipelinedController.StartupFlows, ], references={ PipelinedController.InOut: inout_controller_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP, 'ovs_gtp_port_number': 32768, 'clean_restart': True, 'enable_nat': True, 'uplink_gw_mac': '11:22:33:44:55:66', 'uplink_port': OFPP_LOCAL, 'virtual_interface': cls.BRIDGE, 'mtr_ip': '5.6.7.8', 'mtr_interface': cls.MTR_PORT, 'ovs_mtr_port_number': mtr_port_no, }, mconfig=None, loop=None, service_manager=cls.service_manager, integ_test=False, ) cls.thread = start_ryu_app_thread(test_setup) cls.inout_controller = inout_controller_reference.result() cls.testing_controller = testing_controller_reference.result()
def setUpClass(cls): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures. """ super(UEMacAddressTest, cls).setUpClass() warnings.simplefilter('ignore') cls.service_manager = create_service_manager([], ['ue_mac']) cls._tbl_num = cls.service_manager.get_table_num( UEMacAddressController.APP_NAME, ) ue_mac_controller_reference = Future() testing_controller_reference = Future() test_setup = TestSetup( apps=[ PipelinedController.UEMac, PipelinedController.Testing, PipelinedController.StartupFlows, ], references={ PipelinedController.UEMac: ue_mac_controller_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.Arp: Future(), PipelinedController.StartupFlows: Future(), }, config={ 'setup_type': 'CWF', 'allow_unknown_arps': False, 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP, 'internal_ip_subnet': '192.168.0.0/16', 'ovs_gtp_port_number': 32768, 'clean_restart': True, 'dpi': { 'enabled': False, 'mon_port': 'mon1', 'mon_port_number': 32769, 'idle_timeout': 42, }, }, mconfig=None, loop=None, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE) BridgeTools.create_internal_iface( cls.BRIDGE, cls.DPI_PORT, cls.DPI_IP, ) cls.thread = start_ryu_app_thread(test_setup) cls.ue_mac_controller = ue_mac_controller_reference.result() cls.testing_controller = testing_controller_reference.result()
def setUpClass(cls): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures. """ super(LIMirrorTest, cls).setUpClass() warnings.simplefilter('ignore') cls.service_manager = create_service_manager([], ['li_mirror']) inout_controller_reference = Future() li_mirror_reference = Future() testing_controller_reference = Future() test_setup = TestSetup( apps=[PipelinedController.InOut, PipelinedController.LIMirror, PipelinedController.Testing, PipelinedController.StartupFlows], references={ PipelinedController.InOut: inout_controller_reference, PipelinedController.LIMirror: li_mirror_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'setup_type': 'CWF', 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP, 'internal_ip_subnet': '192.168.0.0/16', 'ovs_gtp_port_number': 32768, 'clean_restart': True, 'li_mirror_all': True, 'li_local_iface': cls.LI_LOCAL_IFACE, 'li_dst_iface': cls.LI_DST_IFACE, 'uplink_port': OFPP_LOCAL }, mconfig=None, loop=None, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE) BridgeTools.create_internal_iface(cls.BRIDGE, cls.LI_LOCAL_IFACE, cls.LI_LOCAL_IP) BridgeTools.create_internal_iface(cls.BRIDGE, cls.LI_DST_IFACE, cls.LI_DST_IP) cls.thread = start_ryu_app_thread(test_setup) cls.inout_controller = inout_controller_reference.result() cls.li_controller = li_mirror_reference.result() cls.testing_controller = testing_controller_reference.result()
def setUpClass(cls): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures. """ super(DPITest, cls).setUpClass() warnings.simplefilter('ignore') cls.service_manager = create_service_manager([PipelineD.DPI], []) dpi_controller_reference = Future() testing_controller_reference = Future() test_setup = TestSetup( apps=[ PipelinedController.DPI, PipelinedController.Testing, PipelinedController.StartupFlows, ], references={ PipelinedController.DPI: dpi_controller_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP, 'ovs_gtp_port_number': 32768, 'clean_restart': True, 'setup_type': 'LTE', 'dpi': { 'enabled': True, 'mon_port': cls.DPI_PORT, 'mon_port_number': 32769, 'idle_timeout': 42, }, }, mconfig=None, loop=None, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE) BridgeTools.create_internal_iface( cls.BRIDGE, cls.DPI_PORT, cls.DPI_IP, ) cls.thread = start_ryu_app_thread(test_setup) cls.dpi_controller = dpi_controller_reference.result() cls.testing_controller = testing_controller_reference.result()
def testSudoUser(self, _, mock_check_call): intf = 'qt' BRIDGE = 'qtbr0' BridgeTools.create_bridge(BRIDGE, BRIDGE) BridgeTools.create_internal_iface(BRIDGE, intf, None) TrafficClass.init_qdisc(intf) mock_check_call.assert_any_call( ["sudo", "tc", "qdisc", "add", "dev", intf, "root", "handle", "1:", "htb"], )
def setUpClass(cls): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures. """ super(UplinkBridgeTestNatIPAddr, cls).setUpClass() warnings.simplefilter('ignore') cls.service_manager = create_service_manager([]) uplink_bridge_controller_reference = Future() testing_controller_reference = Future() test_setup = TestSetup( apps=[ PipelinedController.UplinkBridge, PipelinedController.Testing, PipelinedController.StartupFlows, ], references={ PipelinedController.UplinkBridge: uplink_bridge_controller_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP, 'ovs_gtp_port_number': 32768, 'clean_restart': True, 'enable_nat': True, 'uplink_bridge': cls.UPLINK_BRIDGE, 'sgi_management_iface_ip_addr': cls.SGi_IP, 'uplink_eth_port_name': cls.BRIDGE_ETH_PORT, }, mconfig=None, loop=None, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.BRIDGE) BridgeTools.create_bridge(cls.UPLINK_BRIDGE, cls.UPLINK_BRIDGE) BridgeTools.create_internal_iface( cls.BRIDGE, cls.BRIDGE_ETH_PORT, '2.2.2.2', ) cls.thread = start_ryu_app_thread(test_setup) cls.uplink_br_controller = uplink_bridge_controller_reference.result() cls.testing_controller = testing_controller_reference.result()
def setUpClass(cls): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures. """ super(UplinkBridgeWithNonNATTest, cls).setUpClass() warnings.simplefilter('ignore') cls.service_manager = create_service_manager([]) uplink_bridge_controller_reference = Future() testing_controller_reference = Future() test_setup = TestSetup( apps=[ PipelinedController.UplinkBridge, PipelinedController.Testing, PipelinedController.StartupFlows ], references={ PipelinedController.UplinkBridge: uplink_bridge_controller_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP, 'ovs_gtp_port_number': 32768, 'clean_restart': True, 'enable_nat': False, 'uplink_bridge': cls.UPLINK_BRIDGE, 'uplink_eth_port_name': cls.UPLINK_ETH_PORT, 'virtual_mac': '02:bb:5e:36:06:4b', 'uplink_patch': cls.UPLINK_PATCH, 'uplink_dhcp_port': cls.UPLINK_DHCP, }, mconfig=None, loop=None, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.BRIDGE) # dummy uplink interface BridgeTools.create_bridge(cls.UPLINK_BRIDGE, cls.UPLINK_BRIDGE) BridgeTools.create_internal_iface(cls.UPLINK_BRIDGE, cls.UPLINK_DHCP, None) BridgeTools.create_internal_iface(cls.UPLINK_BRIDGE, cls.UPLINK_PATCH, None) BridgeTools.create_internal_iface(cls.UPLINK_BRIDGE, cls.UPLINK_ETH_PORT, None) cls.thread = start_ryu_app_thread(test_setup) cls.uplink_br_controller = uplink_bridge_controller_reference.result() cls.testing_controller = testing_controller_reference.result()
def setUpClass(cls): BridgeTools.create_bridge(cls.BRIDGE, cls.BRIDGE) BridgeTools.create_internal_iface(cls.BRIDGE, cls.IFACE, None) TrafficClass.init_qdisc(cls.IFACE, True)
def testSanityTrafficClass(self): intf = 'qt' BRIDGE = 'qtbr0' BridgeTools.create_bridge(BRIDGE, BRIDGE) BridgeTools.create_internal_iface(BRIDGE, intf, None) parent_qid = 2 qid = 3 apn_ambr = 1000000 bearer_mbr = 500000 bearer_gbr = 250000 TrafficClass.init_qdisc(intf, show_error=False) # create APN level ambr TrafficClass.create_class(intf, qid=parent_qid, max_bw=apn_ambr) # create child queue TrafficClass.create_class( intf, qid=qid, rate=bearer_gbr, max_bw=bearer_mbr, parent_qid=parent_qid, ) # check if the filters installed for leaf class only filter_output = subprocess.check_output(['tc', 'filter', 'show', 'dev', intf]) filter_list = filter_output.decode('utf-8').split("\n") filter_list = [ln for ln in filter_list if 'classid' in ln] assert('classid 1:{qid}'.format(qid=parent_qid) in filter_list[0]) assert('classid 1:{qid}'.format(qid=qid) in filter_list[1]) # check if classes are installed with appropriate bandwidth limits class_output = subprocess.check_output(['tc', 'class', 'show', 'dev', intf]) class_list = class_output.decode('utf-8').split("\n") for info in class_list: if 'class htb 1:{qid}'.format(qid=qid) in info: child_class = info if 'class htb 1:{qid}'.format(qid=parent_qid) in info: parent_class = info assert(parent_class and 'ceil 1Mbit' in parent_class) assert(child_class and 'rate 250Kbit ceil 500Kbit' in child_class) # check if fq_codel is associated only with the leaf class qdisc_output = subprocess.check_output(['tc', 'qdisc', 'show', 'dev', intf]) # check if read_all_classes work qid_list = TrafficClass.read_all_classes(intf) assert((qid, parent_qid) in qid_list) # delete leaf class TrafficClass.delete_class(intf, 3) # check class for qid 3 removed class_output = subprocess.check_output(['tc', 'class', 'show', 'dev', intf]) class_list = class_output.decode('utf-8').split("\n") assert( not [ info for info in class_list if 'class htb 1:{qid}'.format( qid=qid, ) in info ] ) # delete APN AMBR class TrafficClass.delete_class(intf, 2) # verify that parent class is removed class_output = subprocess.check_output(['tc', 'class', 'show', 'dev', intf]) class_list = class_output.decode('utf-8').split("\n") assert( not [ info for info in class_list if 'class htb 1:{qid}'.format( qid=parent_qid, ) in info ] ) # check if no fq_codel nor filter exists qdisc_output = subprocess.check_output(['tc', 'qdisc', 'show', 'dev', intf]) filter_output = subprocess.check_output(['tc', 'filter', 'show', 'dev', intf]) filter_list = filter_output.decode('utf-8').split("\n") filter_list = [ln for ln in filter_list if 'classid' in ln] qdisc_list = qdisc_output.decode('utf-8').split("\n") qdisc_list = [ln for ln in qdisc_list if 'fq_codel' in ln] assert(not filter_list and not qdisc_list) # destroy all qos on intf run_cmd(['tc qdisc del dev {intf} root'.format(intf=intf)])
def setUpClass(cls): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures, mocks the redis policy_dictionary of dpi_controller """ super(InternalPktIpfixExportTest, cls).setUpClass() warnings.simplefilter('ignore') cls._static_rule_dict = {} cls.service_manager = create_service_manager( [PipelineD.DPI], ['ue_mac', 'ipfix'], ) cls._tbl_num = cls.service_manager.get_table_num( DPIController.APP_NAME, ) ue_mac_controller_reference = Future() dpi_controller_reference = Future() ipfix_controller_reference = Future() testing_controller_reference = Future() test_setup = TestSetup( apps=[ PipelinedController.UEMac, PipelinedController.DPI, PipelinedController.IPFIX, PipelinedController.Testing, PipelinedController.StartupFlows, ], references={ PipelinedController.UEMac: ue_mac_controller_reference, PipelinedController.DPI: dpi_controller_reference, PipelinedController.Arp: Future(), PipelinedController.IPFIX: ipfix_controller_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'bridge_name': cls.BRIDGE, 'bridge_ip_address': '192.168.128.1', 'internal_ip_subnet': '192.168.0.0/16', 'nat_iface': 'eth2', 'enodeb_iface': 'eth1', 'enable_queue_pgm': False, 'clean_restart': True, 'setup_type': 'CWF', 'dpi': { 'enabled': True, 'mon_port': 'mon1', 'mon_port_number': 32769, 'idle_timeout': 42, }, 'ipfix': { 'enabled': True, 'probability': 65, 'collector_set_id': 1, 'collector_ip': '1.1.1.1', 'collector_port': 65010, 'cache_timeout': 60, 'obs_domain_id': 1, 'obs_point_id': 1, }, 'conntrackd': { 'enabled': True, }, 'ovs_gtp_port_number': 32768, }, mconfig=PipelineD(), loop=None, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE) BridgeTools.create_internal_iface( cls.BRIDGE, cls.DPI_PORT, cls.DPI_IP, ) cls.thread = start_ryu_app_thread(test_setup) cls.ue_mac_controller = ue_mac_controller_reference.result() cls.dpi_controller = dpi_controller_reference.result() cls.ipfix_controller = ipfix_controller_reference.result() cls.testing_controller = testing_controller_reference.result() cls.dpi_controller._policy_dict = cls._static_rule_dict
def setUpClass(cls, *_): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures. """ super(UEMacAddressTest, cls).setUpClass() ingress.get_virtual_iface_mac = mocked_get_virtual_iface_mac middle.get_virtual_iface_mac = mocked_get_virtual_iface_mac egress.get_virtual_iface_mac = mocked_get_virtual_iface_mac warnings.simplefilter('ignore') cls.service_manager = create_service_manager([], ['ue_mac', 'arpd']) cls._tbl_num = cls.service_manager.get_table_num( UEMacAddressController.APP_NAME, ) cls._ingress_tbl_num = cls.service_manager.get_table_num(INGRESS) cls._egress_tbl_num = cls.service_manager.get_table_num(EGRESS) ingress_controller_reference = Future() middle_controller_reference = Future() egress_controller_reference = Future() ue_mac_controller_reference = Future() testing_controller_reference = Future() test_setup = TestSetup( apps=[ PipelinedController.Ingress, PipelinedController.Middle, PipelinedController.Egress, PipelinedController.Arp, PipelinedController.UEMac, PipelinedController.Testing, PipelinedController.StartupFlows, ], references={ PipelinedController.Ingress: ingress_controller_reference, PipelinedController.Middle: middle_controller_reference, PipelinedController.Egress: egress_controller_reference, PipelinedController.Arp: Future(), PipelinedController.UEMac: ue_mac_controller_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'setup_type': 'CWF', 'allow_unknown_arps': False, 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP, 'internal_ip_subnet': '192.168.0.0/16', 'ovs_gtp_port_number': 32768, 'virtual_interface': 'testing_br', 'local_ue_eth_addr': False, 'quota_check_ip': '1.2.3.4', 'clean_restart': True, 'dpi': { 'enabled': False, 'mon_port': 'mon1', 'mon_port_number': 32769, 'idle_timeout': 42, }, 'uplink_port': OFPP_LOCAL, }, mconfig=PipelineD(ue_ip_block="192.168.128.0/24", ), loop=None, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE) BridgeTools.create_internal_iface( cls.BRIDGE, cls.DPI_PORT, cls.DPI_IP, ) cls.thread = start_ryu_app_thread(test_setup) cls.ue_mac_controller = ue_mac_controller_reference.result() cls.ingress_controller = ingress_controller_reference.result() cls.middle_controller = middle_controller_reference.result() cls.egress_controller = egress_controller_reference.result() cls.testing_controller = testing_controller_reference.result()
def setUpClass(cls): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures. """ super(UplinkBridgeWithNonNATTest, cls).setUpClass() warnings.simplefilter('ignore') cls.service_manager = create_service_manager([]) uplink_bridge_controller_reference = Future() testing_controller_reference = Future() test_setup = TestSetup( apps=[PipelinedController.UplinkBridge, PipelinedController.Testing, PipelinedController.StartupFlows], references={ PipelinedController.UplinkBridge: uplink_bridge_controller_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP, 'ovs_gtp_port_number': 32768, 'clean_restart': True, 'enable_nat': False, 'uplink_bridge': cls.UPLINK_BRIDGE, 'uplink_eth_port_name': cls.UPLINK_ETH_PORT, 'virtual_mac': '02:bb:5e:36:06:4b', 'uplink_patch': cls.UPLINK_PATCH, 'uplink_dhcp_port': cls.UPLINK_DHCP, 'sgi_management_iface_vlan': "", 'dev_vlan_in': cls.VLAN_DEV_IN, 'dev_vlan_out': cls.VLAN_DEV_OUT, 'ovs_vlan_workaround': False, 'sgi_management_iface_ip_addr': '1.1.11.1', }, mconfig=None, loop=None, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.BRIDGE) BridgeTools.create_bridge(cls.UPLINK_BRIDGE, cls.UPLINK_BRIDGE) BridgeTools.create_veth_pair(cls.VLAN_DEV_IN, cls.VLAN_DEV_OUT) # Add to OVS, BridgeTools.add_ovs_port(cls.UPLINK_BRIDGE, cls.VLAN_DEV_IN, "70") BridgeTools.add_ovs_port(cls.UPLINK_BRIDGE, cls.VLAN_DEV_OUT, "71") # dummy uplink interface vlan = "10" subprocess.Popen(["ovs-vsctl", "set", "port", cls.UPLINK_BRIDGE, "tag=" + vlan]).wait() assert get_ovsdb_port_tag(cls.UPLINK_BRIDGE) == vlan BridgeTools.create_internal_iface(cls.UPLINK_BRIDGE, cls.UPLINK_DHCP, None) BridgeTools.create_internal_iface(cls.UPLINK_BRIDGE, cls.UPLINK_PATCH, None) BridgeTools.create_internal_iface(cls.UPLINK_BRIDGE, cls.UPLINK_ETH_PORT, None) cls.thread = start_ryu_app_thread(test_setup) cls.uplink_br_controller = uplink_bridge_controller_reference.result() cls.testing_controller = testing_controller_reference.result()
def setUpClass(cls): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures. """ super(UplinkBridgeWithNonNatUplinkConnect_Test, cls).setUpClass() warnings.simplefilter('ignore') cls.service_manager = create_service_manager([]) cls._setup_vlan_network("0") BridgeTools.create_bridge(cls.UPLINK_BRIDGE, cls.UPLINK_BRIDGE) BridgeTools.create_internal_iface(cls.UPLINK_BRIDGE, cls.UPLINK_DHCP, None) BridgeTools.create_internal_iface(cls.UPLINK_BRIDGE, cls.UPLINK_PATCH, None) check_connectivity(cls.ROUTER_IP, cls.UPLINK_ETH_PORT) # this is setup after AGW boot up in NATed mode. uplink_bridge_controller_reference = Future() testing_controller_reference = Future() test_setup = TestSetup( apps=[ PipelinedController.UplinkBridge, PipelinedController.Testing, PipelinedController.StartupFlows ], references={ PipelinedController.UplinkBridge: uplink_bridge_controller_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP, 'ovs_gtp_port_number': 32768, 'clean_restart': True, 'enable_nat': False, 'uplink_bridge': cls.UPLINK_BRIDGE, 'uplink_eth_port_name': cls.UPLINK_ETH_PORT, 'virtual_mac': '02:bb:5e:36:06:4b', 'uplink_patch': cls.UPLINK_PATCH, 'uplink_dhcp_port': cls.UPLINK_DHCP, 'sgi_management_iface_vlan': "", 'ovs_vlan_workaround': True, 'dev_vlan_in': "testv1_in", 'dev_vlan_out': "testv1_out", }, mconfig=None, loop=None, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.BRIDGE) cls.thread = start_ryu_app_thread(test_setup) cls.uplink_br_controller = uplink_bridge_controller_reference.result() cls.testing_controller = testing_controller_reference.result()
def setUpClass(cls): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures. """ super(UplinkBridgeWithNonNATTest_IP_VLAN, cls).setUpClass() warnings.simplefilter('ignore') cls.service_manager = create_service_manager([]) uplink_bridge_controller_reference = Future() testing_controller_reference = Future() test_setup = TestSetup( apps=[ PipelinedController.UplinkBridge, PipelinedController.Testing, PipelinedController.StartupFlows ], references={ PipelinedController.UplinkBridge: uplink_bridge_controller_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP, 'ovs_gtp_port_number': 32768, 'clean_restart': True, 'enable_nat': False, 'uplink_bridge': cls.UPLINK_BRIDGE, 'uplink_eth_port_name': cls.UPLINK_ETH_PORT, 'virtual_mac': '02:bb:5e:36:06:4b', 'uplink_patch': cls.UPLINK_PATCH, 'uplink_dhcp_port': cls.UPLINK_DHCP, 'sgi_management_iface_vlan': cls.VLAN_TAG, 'sgi_management_iface_ip_addr': cls.SGi_IP, 'dev_vlan_in': "test_v_in", 'dev_vlan_out': "test_v_out", }, mconfig=None, loop=None, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.BRIDGE) # validate vlan id set vlan = "10" BridgeTools.create_bridge(cls.UPLINK_BRIDGE, cls.UPLINK_BRIDGE) set_ip_cmd = [ "ip", "addr", "replace", "2.33.44.6", "dev", cls.UPLINK_BRIDGE ] subprocess.check_call(set_ip_cmd) BridgeTools.create_internal_iface(cls.UPLINK_BRIDGE, cls.UPLINK_DHCP, None) BridgeTools.create_internal_iface(cls.UPLINK_BRIDGE, cls.UPLINK_PATCH, None) BridgeTools.create_internal_iface(cls.UPLINK_BRIDGE, cls.UPLINK_ETH_PORT, None) cls.thread = start_ryu_app_thread(test_setup) cls.uplink_br_controller = uplink_bridge_controller_reference.result() cls.testing_controller = testing_controller_reference.result()
def setUpClass(cls, *_): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures, mocks the redis policy_dictionary of ue_mac_controller """ super(CWFRestartResilienceTest, cls).setUpClass() warnings.simplefilter('ignore') cls.service_manager = create_service_manager([], ['ue_mac', 'arpd']) ue_mac_controller_reference = Future() testing_controller_reference = Future() def mock_thread_safe(cmd, body): cmd(body) loop_mock = MagicMock() loop_mock.call_soon_threadsafe = mock_thread_safe test_setup = TestSetup( apps=[ PipelinedController.UEMac, PipelinedController.Arp, PipelinedController.Testing, PipelinedController.StartupFlows, ], references={ PipelinedController.UEMac: ue_mac_controller_reference, PipelinedController.Arp: Future(), PipelinedController.Testing: testing_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'setup_type': 'CWF', 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP_ADDRESS, 'enforcement': { 'poll_interval': 5 }, 'internal_ip_subnet': '192.168.0.0/16', 'nat_iface': 'eth2', 'local_ue_eth_addr': False, 'allow_unknown_arps': False, 'enodeb_iface': 'eth1', 'qos': { 'enable': False }, 'clean_restart': False, 'quota_check_ip': '1.2.3.4', 'enable_nat': False, 'dpi': { 'enabled': False, 'mon_port': 'mon1', 'mon_port_number': 32769, 'idle_timeout': 42, }, }, mconfig=PipelineD(ue_ip_block=cls.UE_BLOCK, ), loop=loop_mock, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE) BridgeTools.create_internal_iface(cls.BRIDGE, cls.DPI_PORT, cls.DPI_IP) cls.thread = start_ryu_app_thread(test_setup) cls.ue_mac_controller = ue_mac_controller_reference.result() cls.testing_controller = testing_controller_reference.result()
def setUpClass(cls): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures. """ super(UplinkBridgeWithNonNATTestVlan, cls).setUpClass() warnings.simplefilter('ignore') cls.service_manager = create_service_manager([]) uplink_bridge_controller_reference = Future() testing_controller_reference = Future() test_setup = TestSetup( apps=[ PipelinedController.UplinkBridge, PipelinedController.Testing, PipelinedController.StartupFlows, ], references={ PipelinedController.UplinkBridge: uplink_bridge_controller_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP, 'ovs_gtp_port_number': 32768, 'clean_restart': True, 'enable_nat': False, 'uplink_bridge': cls.UPLINK_BRIDGE, 'uplink_eth_port_name': cls.UPLINK_ETH_PORT, 'virtual_mac': '02:bb:5e:36:06:4b', 'uplink_patch': cls.UPLINK_PATCH, 'uplink_dhcp_port': cls.UPLINK_DHCP, 'sgi_management_iface_vlan': cls.VLAN_TAG, 'dev_vlan_in': cls.VLAN_DEV_IN, 'dev_vlan_out': cls.VLAN_DEV_OUT, 'sgi_management_iface_ip_addr': '1.1.11.1', 'sgi_management_iface_ipv6_addr': 'fe80::48a3:2cff:fe1a:dd47/10', }, mconfig=None, loop=None, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.BRIDGE) BridgeTools.create_bridge(cls.UPLINK_BRIDGE, cls.UPLINK_BRIDGE) BridgeTools.create_veth_pair( cls.VLAN_DEV_IN, cls.VLAN_DEV_OUT, ) # Add to OVS, BridgeTools.add_ovs_port( cls.UPLINK_BRIDGE, cls.VLAN_DEV_IN, "70", ) BridgeTools.add_ovs_port( cls.UPLINK_BRIDGE, cls.VLAN_DEV_OUT, "71", ) BridgeTools.create_bridge(cls.UPLINK_BRIDGE, cls.UPLINK_BRIDGE) BridgeTools.create_internal_iface( cls.UPLINK_BRIDGE, cls.UPLINK_DHCP, None, ) BridgeTools.create_internal_iface( cls.UPLINK_BRIDGE, cls.UPLINK_PATCH, None, ) BridgeTools.create_internal_iface( cls.UPLINK_BRIDGE, cls.UPLINK_ETH_PORT, None, ) cls.thread = start_ryu_app_thread(test_setup) cls.uplink_br_controller = uplink_bridge_controller_reference.result() cls.testing_controller = testing_controller_reference.result()
def setUpClass(cls, *_): """ Starts the thread which launches ryu apps Create a testing bridge, add a port, setup the port interfaces. Then launch the ryu apps for testing pipelined. Gets the references to apps launched by using futures. """ super(UEMacAddressTest, cls).setUpClass() warnings.simplefilter('ignore') cls.service_manager = create_service_manager([], ['ue_mac', 'arpd', 'check_quota']) check_quota_controller_reference = Future() testing_controller_reference = Future() arp_controller_reference = Future() test_setup = TestSetup( apps=[PipelinedController.UEMac, PipelinedController.Arp, PipelinedController.CheckQuotaController, PipelinedController.Testing, PipelinedController.StartupFlows], references={ PipelinedController.CheckQuotaController: check_quota_controller_reference, PipelinedController.Testing: testing_controller_reference, PipelinedController.UEMac: Future(), PipelinedController.Arp: arp_controller_reference, PipelinedController.StartupFlows: Future(), }, config={ 'setup_type': 'CWF', 'allow_unknown_arps': False, 'bridge_name': cls.BRIDGE, 'bridge_ip_address': cls.BRIDGE_IP, 'internal_ip_subnet': '192.168.0.0/16', 'ovs_gtp_port_number': 32768, 'has_quota_port': 50001, 'no_quota_port': 50002, 'quota_check_ip': '1.2.3.4', 'local_ue_eth_addr': False, 'clean_restart': True, 'dpi': { 'enabled': False, 'mon_port': 'mon1', 'mon_port_number': 32769, 'idle_timeout': 42, }, }, mconfig=PipelineD( ue_ip_block='192.168.128.0/24', ), loop=None, service_manager=cls.service_manager, integ_test=False, ) BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE) BridgeTools.create_internal_iface(cls.BRIDGE, cls.DPI_PORT, cls.DPI_IP) cls.thread = start_ryu_app_thread(test_setup) cls.check_quota_controller = check_quota_controller_reference.result() cls.arp_controlelr = arp_controller_reference.result() cls.testing_controller = testing_controller_reference.result()