Beispiel #1
0
    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(AccessControlTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager([])
        cls._tbl_num = cls.service_manager.get_table_num(
            AccessControlController.APP_NAME)

        access_control_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.AccessControl,
                PipelinedController.Testing,
            ],
            references={
                PipelinedController.AccessControl:
                access_control_controller_reference,
                PipelinedController.Testing: testing_controller_reference
            },
            config={
                'bridge_name': cls.BRIDGE,
                'bridge_ip_address': cls.BRIDGE_IP,
                'nat_iface': 'eth2',
                'enodeb_iface': 'eth1',
                'enable_queue_pgm': False,
                'access_control': {
                    'ip_blacklist': [
                        {
                            'ip': cls.INBOUND_TEST_IP,
                            'direction': 'inbound',
                        },
                        {
                            'ip': cls.OUTBOUND_TEST_IP,
                            'direction': 'outbound',
                        },
                        {
                            'ip': cls.BOTH_DIR_TEST_IP,
                        },
                    ]
                }
            },
            mconfig=None,
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)
        cls.access_control_controller = \
            access_control_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()
Beispiel #2
0
    def setUp(self, *_):
        """
        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.
        """
        cls = ArpTableTestRouterIP
        add_to_ip_blocks_list('1.1.1.0/24')
        add_to_ip_blocks_list('2.2.2.2')

        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager([], ['arpd'])
        cls._tbl_num = cls.service_manager.get_table_num(ArpController.APP_NAME)

        arp.mobilityd_list_ip_blocks = mocked_mobilityd_list_ip_blocks
        arp_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.Arp,
                PipelinedController.Testing,
                PipelinedController.StartupFlows
            ],
            references={
                PipelinedController.Arp:
                    arp_controller_reference,
                PipelinedController.Testing:
                    testing_controller_reference,
                PipelinedController.StartupFlows:
                    Future(),
            },
            config={
                'setup_type': 'LTE',
                'allow_unknown_arps': False,
                'bridge_name': cls.BRIDGE,
                'bridge_ip_address': cls.BRIDGE_IP,
                'ovs_gtp_port_number': 32768,
                'virtual_mac': cls.VIRTUAL_MAC,
                'local_ue_eth_addr': True,
                'quota_check_ip': '1.2.3.4',
                'clean_restart': True,
                'enable_nat': False,
                'mtr_ip': cls.MTR_IP,
                'mtr_mac': cls.MTR_MAC,
            },
            mconfig=PipelineD(
                ue_ip_block=cls.UE_BLOCK,
            ),
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)
        cls.arp_controller = arp_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(IPV6RouterSolicitationTableTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager(
            [],
            ['ipv6_solicitation'],
        )
        cls._tbl_num = cls.service_manager.get_table_num(
            IPV6SolicitationController.APP_NAME)

        ipv6_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.IPV6RouterSolicitation,
                PipelinedController.Testing,
                PipelinedController.StartupFlows,
            ],
            references={
                PipelinedController.IPV6RouterSolicitation:
                ipv6_controller_reference,
                PipelinedController.Testing: testing_controller_reference,
                PipelinedController.StartupFlows: Future(),
            },
            config={
                'setup_type': 'LTE',
                'allow_unknown_arps': False,
                'bridge_name': cls.BRIDGE,
                'bridge_ip_address': cls.BRIDGE_IP,
                'ovs_gtp_port_number': 32768,
                'virtual_interface': cls.BRIDGE,
                'local_ue_eth_addr': True,
                'quota_check_ip': '1.2.3.4',
                'ipv6_router_addr': 'd88d:aba4:472f:fc95:7e7d:8457:5301:ebce',
                'clean_restart': True,
                'virtual_mac': 'd6:34:bc:81:5d:40',
                'enable_nat': True,
            },
            mconfig=PipelineD(ue_ip_block=cls.UE_BLOCK, ),
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)
        cls.solicitation_controller = ipv6_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()

        cls._prefix_dict = {}
        cls.solicitation_controller._prefix_mapper._prefix_by_interface = \
            cls._prefix_dict
Beispiel #4
0
    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(TunnelLearnTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager(
            [],
            ['ue_mac', 'tunnel_learn'],
        )
        cls._tbl_num = cls.service_manager.get_table_num(
            TunnelLearnController.APP_NAME, )

        tunnel_learn_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.TunnelLearnController,
                PipelinedController.Testing,
                PipelinedController.StartupFlows,
            ],
            references={
                PipelinedController.TunnelLearnController:
                tunnel_learn_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',
                'nat_iface': 'eth2',
                'enodeb_iface': 'eth1',
                'qos': {
                    'enable': False
                },
                'clean_restart': True,
                'access_control': {
                    'ip_blocklist': [],
                },
            },
            mconfig=PipelineD(allowed_gre_peers=[], ),
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)
        cls.tunnel_learn_controller = \
            tunnel_learn_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()
Beispiel #5
0
    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 gy_controller
        """
        super(GYTableTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager([PipelineD.ENFORCEMENT],
                                                     ['arpd'])
        cls._tbl_num = cls.service_manager.get_table_num(GYController.APP_NAME)

        gy_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.GY, PipelinedController.Arp,
                PipelinedController.Testing, PipelinedController.StartupFlows
            ],
            references={
                PipelinedController.GY: gy_controller_reference,
                PipelinedController.Arp: Future(),
                PipelinedController.Testing: testing_controller_reference,
                PipelinedController.StartupFlows: Future(),
            },
            config={
                'setup_type': 'CWF',
                'allow_unknown_arps': False,
                '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,
                'local_ue_eth_addr': False,
                'qos': {
                    'enable': False
                },
                'dpi': {
                    'enable': False
                },
                'clean_restart': True,
            },
            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)

        cls.thread = start_ryu_app_thread(test_setup)

        cls.gy_controller = gy_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()

        cls.gy_controller._redirect_manager._save_redirect_entry = MagicMock()
Beispiel #6
0
    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(InOutTestNonNATBasicFlows, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager([])

        ingress_controller_reference = Future()
        middle_controller_reference = Future()
        egress_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.Ingress,
                PipelinedController.Middle,
                PipelinedController.Egress,
                PipelinedController.Testing,
                PipelinedController.StartupFlows,
            ],
            references={
                PipelinedController.Ingress:
                    ingress_controller_reference,
                PipelinedController.Middle:
                    middle_controller_reference,
                PipelinedController.Egress:
                    egress_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_gw_mac': '11:22:33:44:55:66',
                'uplink_port': OFPP_LOCAL,
            },
            mconfig=None,
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)
        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()
Beispiel #7
0
    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 enforcement_controller
        """
        super(EnforcementTableTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls._static_rule_dict = {}
        cls.service_manager = create_service_manager([PipelineD.ENFORCEMENT])
        cls._tbl_num = cls.service_manager.get_table_num(
            EnforcementController.APP_NAME,
        )

        enforcement_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.Enforcement,
                PipelinedController.Testing,
                PipelinedController.StartupFlows,
            ],
            references={
                PipelinedController.Enforcement:
                    enforcement_controller_reference,
                PipelinedController.Testing:
                    testing_controller_reference,
                PipelinedController.StartupFlows:
                    Future(),
            },
            config={
                'bridge_name': cls.BRIDGE,
                'bridge_ip_address': '192.168.128.1',
                'nat_iface': 'eth2',
                'enodeb_iface': 'eth1',
                'qos': {'enable': False},
                'clean_restart': True,
                'uplink_port': 20,
                'enable_nat': True,
                'ovs_gtp_port_number': 10,
                'setup_type': 'LTE',
            },
            mconfig=PipelineD(),
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)

        cls.enforcement_controller = enforcement_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()

        cls.enforcement_controller._policy_dict = cls._static_rule_dict
Beispiel #8
0
    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.
        """
        he.activate_he_urls_for_ue = mocked_activate_he_urls_for_ue
        he.deactivate_he_urls_for_ue = mocked_deactivate_he_urls_for_ue

        super(HeTableTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager([], ['proxy'])
        cls._tbl_num = cls.service_manager.get_table_num(HeaderEnrichmentController.APP_NAME)

        BridgeTools.create_veth_pair(cls.VETH, cls.VETH_NS)
        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)
        BridgeTools.add_ovs_port(cls.BRIDGE, cls.VETH, cls.PROXY_PORT)

        he_controller_reference = Future()
        testing_controller_reference = Future()

        test_setup = TestSetup(
            apps=[
                PipelinedController.HeaderEnrichment,
                PipelinedController.Testing,
                PipelinedController.StartupFlows,
            ],
            references={
                PipelinedController.HeaderEnrichment:
                    he_controller_reference,
                PipelinedController.Testing:
                    testing_controller_reference,
                PipelinedController.StartupFlows:
                    Future(),
            },
            config={
                'setup_type': 'LTE',
                'bridge_name': cls.BRIDGE,
                'bridge_ip_address': cls.BRIDGE_IP,
                'uplink_port': 20,
                'proxy_port_name': cls.VETH,
                'clean_restart': True,
                'enable_nat': True,
                'ovs_gtp_port_number': 10,
            },
            mconfig=PipelineD(
                ue_ip_block=cls.UE_BLOCK,
            ),
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        cls.thread = start_ryu_app_thread(test_setup)
        cls.he_controller = he_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()
Beispiel #9
0
    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()
Beispiel #10
0
    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()
Beispiel #11
0
    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()
Beispiel #12
0
    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()
Beispiel #13
0
    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()
Beispiel #14
0
    def setUp(self):
        self._dhcp_gw_info_mock = store.GatewayInfoMap()

        self._dhcp_gw_info_mock[DHCP_Router_key] = '192.168.128.211'
        logging.info("set router key [{}]".format(self._dhcp_gw_info_mock[DHCP_Router_key]))

        """
        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.
        """
        cls = self.__class__
        super(InOutNonNatTest, cls).setUpClass()
        warnings.simplefilter('ignore')

        cls.setup_uplink_br()
        cls.service_manager = create_service_manager([])

        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={
                'setup_type': 'LTE',
                'bridge_name': cls.BRIDGE,
                'bridge_ip_address': cls.BRIDGE_IP,
                'ovs_gtp_port_number': 32768,
                'clean_restart': True,
                'enable_nat': False,
                'non_mat_gw_probe_frequency': .2,
                'non_nat_arp_egress_port': 't_dhcp0',
                'ovs_uplink_port_name': 'patch-up'
            },
            mconfig=None,
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)
        cls.thread = start_ryu_app_thread(test_setup)

        cls.inout_controller = inout_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()
Beispiel #15
0
    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([], include_ue_mac=True)
        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)

        inout_controller_reference = Future()
        ue_mac_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[PipelinedController.InOut,
                  PipelinedController.Arp,
                  PipelinedController.UEMac,
                  PipelinedController.Testing],
            references={
                PipelinedController.InOut:
                    inout_controller_reference,
                PipelinedController.Arp:
                    Future(),
                PipelinedController.UEMac:
                    ue_mac_controller_reference,
                PipelinedController.Testing:
                    testing_controller_reference
            },
            config={
                'setup_type': 'CWF',
                'allow_unknown_arps': False,
                'bridge_name': cls.BRIDGE,
                'bridge_ip_address': cls.BRIDGE_IP,
                'ovs_gtp_port_number': 32768,
                'virtual_interface': 'testing_br',
                'local_ue_eth_addr': False,
            },
            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)

        cls.thread = start_ryu_app_thread(test_setup)
        cls.ue_mac_controller = ue_mac_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()
Beispiel #16
0
    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.
        """
        inout.getmacbyip6 = mocked_getmacbyip6
        inout.get_mobilityd_gw_info = mocked_get_mobilityd_gw_info
        inout.set_mobilityd_gw_info = mocked_set_mobilityd_gw_info

        super(InOutTestNonNATBasicFlowsIPv6, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager([])

        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={
                'setup_type': 'LTE',
                'bridge_name': cls.BRIDGE,
                'bridge_ip_address': cls.BRIDGE_IP,
                'ovs_gtp_port_number': 32768,
                'clean_restart': True,
                'enable_nat': False,
                'uplink_gw_mac': '11:22:33:44:55:11',
                'uplink_port': OFPP_LOCAL,
                'non_nat_gw_probe_frequency': 0.5,
            },
            mconfig=None,
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)
        cls.inout_controller = inout_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()
Beispiel #17
0
    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([], include_ue_mac=True)
        check_quota_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[PipelinedController.CheckQuotaController,
                  PipelinedController.Arp,
                  PipelinedController.Testing,
                  PipelinedController.StartupFlows],
            references={
                PipelinedController.CheckQuotaController:
                    check_quota_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,
                '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,
            },
            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)

        cls.thread = start_ryu_app_thread(test_setup)
        cls.check_quota_controller = check_quota_controller_reference.result()
        cls.check_quota_controller._setup_fake_ip_arp = MagicMock()
        cls.testing_controller = testing_controller_reference.result()
Beispiel #18
0
    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(QfigtpTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager([], ['classifier'])
        classifier_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.Classifier,
                PipelinedController.Testing,
                PipelinedController.StartupFlows,
            ],
            references={
                PipelinedController.Classifier:
                    classifier_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,
                'ovs_mtr_port_number': 15577,
                'mtr_ip': cls.MTR_IP,
                'ovs_internal_sampling_port_number': 15578,
                'ovs_internal_sampling_fwd_tbl_number': 201,
                'ovs_internal_conntrack_port_number': 15579,
                'ovs_internal_conntrack_fwd_tbl_number': 202,
                'clean_restart': True,
                'ovs_multi_tunnel': False,
                'paging_timeout': 30,
                'classifier_controller_id': 5,
                'enable_nat': True,
                'ovs_uplink_port_name': "patch-up",
            },
            mconfig=None,
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
            rpc_stubs={'sessiond_setinterface': MagicMock()},
        )
        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)
        cls.thread = start_ryu_app_thread(test_setup)
        cls.classifier_controller = classifier_reference.result()
        cls.testing_controller = testing_controller_reference.result()
Beispiel #19
0
    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()
Beispiel #20
0
    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 enforcement_controller
        """
        super(RedirectTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager([PipelineD.ENFORCEMENT])
        cls._tbl_num = cls.service_manager.get_table_num(
            EnforcementController.APP_NAME)

        enforcement_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.Enforcement, PipelinedController.Testing,
                PipelinedController.StartupFlows
            ],
            references={
                PipelinedController.Enforcement:
                enforcement_controller_reference,
                PipelinedController.Testing: testing_controller_reference,
                PipelinedController.StartupFlows: Future(),
            },
            config={
                'bridge_name': cls.BRIDGE,
                'bridge_ip_address': cls.BRIDGE_IP_ADDRESS,
                'nat_iface': 'eth2',
                'enodeb_iface': 'eth1',
                'qos': {
                    'enable': False
                },
                'clean_restart': True,
            },
            mconfig=PipelineD(relay_enabled=True),
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)

        cls.enforcement_controller = enforcement_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()

        cls.enforcement_controller._redirect_manager._save_redirect_entry =\
            MagicMock()
Beispiel #21
0
    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(ArpTableTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager([PipelineD.ENFORCEMENT])
        cls._tbl_num = cls.service_manager.get_table_num(ArpController.APP_NAME)

        arp_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.Arp,
                PipelinedController.Testing,
                PipelinedController.StartupFlows
            ],
            references={
                PipelinedController.Arp:
                    arp_controller_reference,
                PipelinedController.Testing:
                    testing_controller_reference,
                PipelinedController.StartupFlows:
                    Future(),
            },
            config={
                'setup_type': 'LTE',
                'allow_unknown_arps': False,
                'bridge_name': cls.BRIDGE,
                'bridge_ip_address': cls.BRIDGE_IP,
                'ovs_gtp_port_number': 32768,
                'virtual_interface': cls.BRIDGE,
                'local_ue_eth_addr': True,
                'clean_restart': True,
            },
            mconfig=PipelineD(
                ue_ip_block=cls.UE_BLOCK,
            ),
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)
        cls.arp_controller = arp_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(GTPTrafficTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager([], ['classifier'])
        cls._tbl_num = cls.service_manager.get_table_num(Classifier.APP_NAME)

        testing_controller_reference = Future()
        classifier_reference = Future()
        test_setup = TestSetup(
            apps=[PipelinedController.Classifier,
                  PipelinedController.Testing,
                  PipelinedController.StartupFlows],
            references={
                PipelinedController.Classifier:
                    classifier_reference,
                PipelinedController.Testing:
                    testing_controller_reference,
                PipelinedController.StartupFlows:
                    Future(),
            },
            config={
                'bridge_name': cls.BRIDGE,
                'bridge_ip_address': cls.BRIDGE_IP,
                'internal_ip_subnet': '192.168.0.0/16',
                'ovs_gtp_port_number': 32768,
                'ovs_mtr_port_number': 15577,
                'mtr_ip': cls.MTR_IP,
                'ovs_internal_sampling_port_number': 15578,
                'ovs_internal_sampling_fwd_tbl_number': 201,
                'clean_restart': True,
                'ovs_multi_tunnel': False,
            },
            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)
        cls.thread = start_ryu_app_thread(test_setup)
        cls.classifier_controller = classifier_reference.result()
        cls.testing_controller = testing_controller_reference.result()
    def setUp(self):
        """
        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(NGServiceControllerTest, self).setUpClass()
        warnings.simplefilter('ignore')
        self.service_manager = create_service_manager([])

        ng_services_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.NGServiceController,
                PipelinedController.Testing,
                PipelinedController.StartupFlows,
            ],
            references={
                PipelinedController.NGServiceController:
                ng_services_controller_reference,
                PipelinedController.Testing: testing_controller_reference,
                PipelinedController.StartupFlows: Future(),
            },
            config={
                'enodeb_iface': 'eth1',
                'clean_restart': True,
                '5G_feature_set': {
                    'enable': True
                },
                '5G_feature_set': {
                    'node_identifier': '192.168.220.1'
                },
                'bridge_name': self.BRIDGE,
            },
            mconfig=None,
            loop=None,
            service_manager=self.service_manager,
            integ_test=False,
            rpc_stubs={'sessiond_setinterface': MagicMock()},
        )

        BridgeTools.create_bridge(self.BRIDGE, self.IFACE)

        self.thread = start_ryu_app_thread(test_setup)
        self.ng_services_controller = \
            ng_services_controller_reference.result()
        self.testing_controller = testing_controller_reference.result()
Beispiel #24
0
    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(IPFIXTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager([], include_ipfix=True)

        ipfix_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.IPFIX, PipelinedController.Testing,
                PipelinedController.StartupFlows
            ],
            references={
                PipelinedController.IPFIX: ipfix_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,
                'ipfix': {
                    'enabled': 'true',
                    'probability': 30000,
                    'collector_ip': '10.22.20.116',
                    'collector_port': 4740,
                    'collector_set_id': 1,
                    'obs_domain_id': 1,
                    'obs_point_id': 1,
                },
                'clean_restart': True,
            },
            mconfig=None,
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)
        cls.ipfix_controller = ipfix_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()
Beispiel #25
0
    def setUpClass(cls):
        super(MeterStatsTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        service_manager = create_service_manager([PipelineD.METERING])
        cls._tbl_num = service_manager.get_table_num(MeterController.APP_NAME)

        meter_ref = Future()
        testing_controller_reference = Future()
        meter_stat_ref = 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.Meter, PipelinedController.Testing,
            PipelinedController.MeterStats
        ],
                               references={
                                   PipelinedController.Meter: meter_ref,
                                   PipelinedController.Testing:
                                   testing_controller_reference,
                                   PipelinedController.MeterStats:
                                   meter_stat_ref
                               },
                               config={
                                   'bridge_name': cls.BRIDGE,
                                   'bridge_ip_address': '192.168.128.1',
                                   'meter': {
                                       'poll_interval': 3,
                                       'enabled': True
                                   },
                               },
                               mconfig={},
                               loop=loop_mock,
                               service_manager=service_manager,
                               integ_test=False,
                               rpc_stubs={'metering_cloud': MagicMock()})
        BridgeTools.create_bridge(cls.BRIDGE, cls.BRIDGE)

        cls.thread = start_ryu_app_thread(test_setup)

        cls.meter_controller = meter_ref.result()
        cls.stats_controller = meter_stat_ref.result()
        cls.testing_controller = testing_controller_reference.result()

        cls.stats_controller._sync_stats = MagicMock()
Beispiel #26
0
    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(VlanLearnTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager(
            [],
            ['ue_mac', 'vlan_learn'],
        )

        vlan_learn_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.VlanLearn,
                PipelinedController.Testing,
                PipelinedController.StartupFlows,
            ],
            references={
                PipelinedController.VlanLearn: vlan_learn_controller_reference,
                PipelinedController.Testing: testing_controller_reference,
                PipelinedController.StartupFlows: Future(),
            },
            config={
                '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,
            },
            mconfig=None,
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)
        cls.vlan_learn_controller = vlan_learn_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()
Beispiel #27
0
    def __init__(self):
        self.static_rules = PolicyRuleDict()

        # Local sessiond
        self.sessiond = session_manager_pb2_grpc.LocalSessionManagerStub(
            ServiceRegistry.get_rpc_channel("sessiond",
                                            ServiceRegistry.LOCAL), )

        self.proxy_responder = session_manager_pb2_grpc.SessionProxyResponderStub(
            ServiceRegistry.get_rpc_channel("sessiond",
                                            ServiceRegistry.LOCAL), )

        # Mock session controller server
        cloud_port = load_service_config("sessiond")["local_controller_port"]
        self.controller = MockSessionManager()
        self.server = grpc.server(ThreadPoolExecutor(max_workers=10))
        session_manager_pb2_grpc.add_CentralSessionControllerServicer_to_server(
            self.controller,
            self.server,
        )
        self.server.add_insecure_port('127.0.0.1:{}'.format(cloud_port))
        self.server.start()

        # Add new controller to bridge
        BridgeTools.add_controller_to_bridge(self.BRIDGE, self.CONTROLLER_PORT)

        # Start ryu test controller for adding flows
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[PipelinedController.Testing],
            references={
                PipelinedController.Testing: testing_controller_reference,
            },
            config={
                'bridge_name': self.BRIDGE,
                'bridge_ip_address': '192.168.128.1',
                'controller_port': self.CONTROLLER_PORT,
            },
            mconfig=None,
            loop=None,
            integ_test=True,
        )
        self.thread = start_ryu_app_thread(test_setup)
        self.testing_controller = testing_controller_reference.result()
Beispiel #28
0
    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(AbstractAccessControlTest, cls).setUpClass()
        warnings.simplefilter('ignore')
        cls.service_manager = create_service_manager(
            [],
            ['access_control'],
        )
        cls._tbl_num = cls.service_manager.get_table_num(
            AccessControlController.APP_NAME, )

        access_control_controller_reference = Future()
        testing_controller_reference = Future()
        test_setup = TestSetup(
            apps=[
                PipelinedController.AccessControl,
                PipelinedController.Testing,
                PipelinedController.StartupFlows,
            ],
            references={
                PipelinedController.AccessControl:
                access_control_controller_reference,
                PipelinedController.Testing: testing_controller_reference,
                PipelinedController.StartupFlows: Future(),
            },
            config=cls.get_config(),
            mconfig=cls.get_mconfig(),
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)
        cls.access_control_controller = \
            access_control_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()
Beispiel #29
0
    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([], include_ue_mac=True)
        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],
            references={
                PipelinedController.UEMac:
                    ue_mac_controller_reference,
                PipelinedController.Testing:
                    testing_controller_reference
            },
            config={
                'bridge_name': cls.BRIDGE,
                'bridge_ip_address': cls.BRIDGE_IP,
                'ovs_gtp_port_number': 32768,
            },
            mconfig=None,
            loop=None,
            service_manager=cls.service_manager,
            integ_test=False,
        )

        BridgeTools.create_bridge(cls.BRIDGE, cls.IFACE)

        cls.thread = start_ryu_app_thread(test_setup)
        cls.ue_mac_controller = ue_mac_controller_reference.result()
        cls.testing_controller = testing_controller_reference.result()
Beispiel #30
0
    def setUp(self):
        """
        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 enforcement_controller.
        Mocks the loop for testing EnforcementStatsController
        """
        super(EnforcementStatsTest, self).setUpClass()
        warnings.simplefilter('ignore')
        self._static_rule_dict = {}
        self.service_manager = create_service_manager([PipelineD.ENFORCEMENT])
        self._main_tbl_num = self.service_manager.get_table_num(
            EnforcementController.APP_NAME)

        enforcement_controller_reference = Future()
        testing_controller_reference = Future()
        enf_stat_ref = Future()
        """
        Enforcement_stats reports data by using loop.call_soon_threadsafe, but
        as we don't have an eventloop in testing, just directly call the stats
        handling function

        Here is how the mocked function is used in EnforcementStatsController:
        self.loop.call_soon_threadsafe(self._handle_flow_stats, ev.msg.body)
        """
        def mock_thread_safe(cmd, body):
            cmd(body)

        loop_mock = MagicMock()
        loop_mock.call_soon_threadsafe = mock_thread_safe

        test_setup = TestSetup(apps=[
            PipelinedController.Enforcement,
            PipelinedController.Enforcement_stats, PipelinedController.Testing,
            PipelinedController.StartupFlows
        ],
                               references={
                                   PipelinedController.Enforcement:
                                   enforcement_controller_reference,
                                   PipelinedController.Testing:
                                   testing_controller_reference,
                                   PipelinedController.Enforcement_stats:
                                   enf_stat_ref,
                                   PipelinedController.StartupFlows: Future(),
                               },
                               config={
                                   'bridge_name': self.BRIDGE,
                                   'bridge_ip_address': '192.168.128.1',
                                   'enforcement': {
                                       'poll_interval': 2
                                   },
                                   'nat_iface': 'eth2',
                                   'enodeb_iface': 'eth1',
                                   'qos': {
                                       'enable': False
                                   },
                                   'clean_restart': True,
                               },
                               mconfig=PipelineD(),
                               loop=loop_mock,
                               service_manager=self.service_manager,
                               integ_test=False,
                               rpc_stubs={'sessiond': MagicMock()})

        BridgeTools.create_bridge(self.BRIDGE, self.IFACE)

        self.thread = start_ryu_app_thread(test_setup)

        self.enforcement_stats_controller = enf_stat_ref.result()
        self._scratch_tbl_num = self.enforcement_stats_controller.tbl_num
        self.enforcement_controller = enforcement_controller_reference.result()
        self.testing_controller = testing_controller_reference.result()

        self.enforcement_stats_controller._policy_dict = self._static_rule_dict
        self.enforcement_stats_controller._report_usage = MagicMock()

        self.enforcement_controller._policy_dict = self._static_rule_dict
        self.enforcement_controller._redirect_manager._save_redirect_entry = \
            MagicMock()