コード例 #1
0
ファイル: test_span.py プロジェクト: charleschou56/oftest
    def runTest(self):
        ports = sorted(config["port_map"].keys())

        s1_vlan_id = 10

        t1 = (Tenant('t1').segment(
            's1', 'vlan', [], s1_vlan_id).segment_member(
                SegmentMember('s1', cfg.leaf0['id']).ports(
                    [cfg.leaf0['portB'].name])).segment_member(
                        SegmentMember('s1', cfg.leaf1['id']).ports(
                            [cfg.leaf1['portB'].name])).build())

        session_id = 1
        source_port = cfg.leaf0['portB'].number
        target_port = cfg.leaf0['portA'].number

        for direction in ['tx', 'both']:
            span = (SPAN(session_id).source(cfg.leaf0['id'], source_port,
                                            direction).target(
                                                cfg.leaf0['id'],
                                                target_port).build())

            wait_for_system_stable()

            cfg.host1['ip'] = '192.168.10.10'
            cfg.host3['ip'] = '192.168.10.20'

            pkt_from_p3_to_p1 = simple_tcp_packet(pktlen=68,
                                                  dl_vlan_enable=True,
                                                  vlan_vid=s1_vlan_id,
                                                  eth_dst=cfg.host1['mac'],
                                                  eth_src=cfg.host3['mac'],
                                                  ip_dst=cfg.host1['ip'],
                                                  ip_src=cfg.host3['ip'])

            expected_pkt_from_p1 = simple_tcp_packet(pktlen=64,
                                                     eth_dst=cfg.host1['mac'],
                                                     eth_src=cfg.host3['mac'],
                                                     ip_dst=cfg.host1['ip'],
                                                     ip_src=cfg.host3['ip'])

            # check monitor status from source to target
            self.dataplane.send(ports[3], str(pkt_from_p3_to_p1))
            # monitor port shall receive the packet
            verify_packet(self, str(pkt_from_p3_to_p1), ports[0])
            verify_packet(self, str(expected_pkt_from_p1), ports[1])

            # clear queue packet
            self.dataplane.flush()

            span.destroy()

            wait_for_system_process()

        t1.destroy()
コード例 #2
0
    def runTest(self):
        ports = sorted(config["port_map"].keys())

        session_id = 1
        source_port = cfg.leaf0['portA'].number
        target_port = cfg.leaf1['portA'].number
        direction = 'rx'

        span = (
            SPAN(session_id)
            .source(cfg.leaf0['id'], source_port, direction)
            .target(cfg.leaf1['id'], target_port)
            .build()
        )

        wait_for_system_stable()

        cfg.host0['ip'] = '192.168.10.10'
        cfg.host1['ip'] = '192.168.10.20'

        def test_by_packet():
            pkt_from_src = simple_tcp_packet(
                pktlen=68,
                dl_vlan_enable=True,
                vlan_vid=20,
                eth_dst=cfg.host1['mac'],
                eth_src=cfg.host0['mac'],
                ip_dst=cfg.host1['ip'],
                ip_src=cfg.host0['ip']
            )

            # check monitor status from source to target
            self.dataplane.send(ports[0], str(pkt_from_src))
            verify_no_packet(self, str(pkt_from_src), ports[1])
            verify_packet(self, str(pkt_from_src), ports[2])

        self.disconnet_and_connect_device(test_by_packet)

        span.destroy()
コード例 #3
0
ファイル: test_span_api.py プロジェクト: charleschou56/oftest
    def runTest(self):
        session_id = 1
        source_port = cfg.leaf0['portA'].number
        target_port = cfg.leaf0['portB'].number
        direction = 'both'

        span = (SPAN(session_id).source(cfg.leaf0['id'], source_port,
                                        direction).target(
                                            cfg.leaf0['id'],
                                            target_port).build())

        actual_session = span.get_session(session_id)
        assert (
            span._source['device_id'] == actual_session['src']['device_id'])
        assert (span._source['port'] == actual_session['src']['port'])
        assert (
            span._source['direction'] == actual_session['src']['direction'])
        assert (
            span._target['device_id'] == actual_session['target']['device_id'])
        assert (span._target['port'] == actual_session['target']['port'])

        span.destroy()
コード例 #4
0
ファイル: test_span.py プロジェクト: charleschou56/oftest
    def runTest(self):
        ports = sorted(config["port_map"].keys())

        session_id = 1
        source_port = cfg.leaf0['portA'].number
        target_port = cfg.leaf0['portB'].number

        for direction in ['rx', 'both']:
            span = (SPAN(session_id).source(cfg.leaf0['id'], source_port,
                                            direction).target(
                                                cfg.leaf0['id'],
                                                target_port).build())

            wait_for_system_process()

            cfg.host0['ip'] = '192.168.10.10'
            cfg.host1['ip'] = '192.168.10.20'

            pkt_from_src = simple_tcp_packet(pktlen=68,
                                             dl_vlan_enable=True,
                                             vlan_vid=20,
                                             eth_dst=cfg.host1['mac'],
                                             eth_src=cfg.host0['mac'],
                                             ip_dst=cfg.host1['ip'],
                                             ip_src=cfg.host0['ip'])

            # check monitor status from source to target
            self.dataplane.send(ports[0], str(pkt_from_src))
            verify_packet(self, str(pkt_from_src), ports[1])
            verify_no_packet(self, str(pkt_from_src), ports[2])

            # clear queue packet
            self.dataplane.flush()

            span.destroy()

            wait_for_system_process()