Exemplo n.º 1
0
    def test_l2_mode(self):
        """ VXLAN L2 mode """
        t = VppVxlanTunnel(self,
                           src=self.pg0.local_ip4,
                           dst=self.pg0.remote_ip4,
                           vni=1000,
                           is_l3=False)
        t.add_vpp_config()
        t.config_ip4()
        t.admin_up()

        dstIP = t.local_ip4[:-1] + "2"

        # Create a packet to send
        p = (Ether(dst=self.pg1.local_mac, src=self.pg1.remote_mac) /
             IP(src=self.pg1.local_ip4, dst=dstIP) /
             UDP(sport=555, dport=556) / Raw(b'\x00' * 80))

        # Expect ARP request
        rx = self.send_and_expect(self.pg1, [p], self.pg0)
        for p in rx:
            self.assertEqual(p[Ether].dst, self.pg0.remote_mac)
            self.assertEqual(p[Ether].src, self.pg0.local_mac)
            self.assertEqual(p[ARP].op, 1)
            self.assertEqual(p[ARP].pdst, dstIP)

        # Resolve ARP
        VppNeighbor(self, t.sw_if_index, self.pg1.remote_mac,
                    dstIP).add_vpp_config()

        # Send packets
        NUM_PKTS = 128
        rx = self.send_and_expect(self.pg1, p * NUM_PKTS, self.pg0)
        self.assertEqual(NUM_PKTS, len(rx))
Exemplo n.º 2
0
    def test_xconnect(self):
        """ VXLAN source address not local """

        #
        # test the broken configuration of a VXLAN tunnel whose
        # source address is not local ot the box. packets sent
        # through the tunnel should be dropped
        #
        t = VppVxlanTunnel(self,
                           src="10.0.0.5",
                           dst=self.pg0.local_ip4,
                           vni=1000)
        t.add_vpp_config()
        t.admin_up()

        self.vapi.sw_interface_set_l2_xconnect(t.sw_if_index,
                                               self.pg1.sw_if_index,
                                               enable=1)
        self.vapi.sw_interface_set_l2_xconnect(self.pg1.sw_if_index,
                                               t.sw_if_index,
                                               enable=1)

        p = (Ether(src="00:11:22:33:44:55", dst="00:00:00:11:22:33") /
             IP(src="4.3.2.1", dst="1.2.3.4") / UDP(sport=20000, dport=10000) /
             Raw(b'\xa5' * 1450))

        rx = self.send_and_assert_no_replies(self.pg1, [p])