-
- self.cli(0, "lb vip 2001::/16 encap gre6")
- for asid in self.ass:
- self.cli(0, "lb as 2001::/16 2002::%u" % (asid))
-
- self.pg_add_stream(0, self.generatePackets(0))
- self.pg_enable_capture([0,1])
- self.pg_start()
-
- # Scapy fails parsing IPv6 over GRE and IPv6 over GRE.
- # This check is therefore disabled for now.
- #self.checkCapture(0, 0)
-
- for asid in self.ass:
- self.cli(0, "lb as 2001::/16 2002::%u del" % (asid))
- self.cli(0, "lb vip 2001::/16 encap gre6 del")
-
+ try:
+ self.vapi.cli("lb vip 2001::/16 encap gre6")
+ for asid in self.ass:
+ self.vapi.cli("lb as 2001::/16 2002::%u" % (asid))
+
+ self.pg0.add_stream(self.generatePackets(self.pg0, isv4=False))
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+
+ self.checkCapture(encap='gre6', isv4=False)
+ finally:
+ for asid in self.ass:
+ self.vapi.cli("lb as 2001::/16 2002::%u del" % (asid))
+ self.vapi.cli("lb vip 2001::/16 encap gre6 del")
+ self.vapi.cli("test lb flowtable flush")
+
+ def test_lb_ip4_l3dsr(self):
+ """ Load Balancer IP4 L3DSR """
+ try:
+ self.vapi.cli("lb vip 90.0.0.0/8 encap l3dsr dscp 7")
+ for asid in self.ass:
+ self.vapi.cli("lb as 90.0.0.0/8 10.0.0.%u" % (asid))
+
+ self.pg0.add_stream(self.generatePackets(self.pg0, isv4=True))
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+ self.checkCapture(encap='l3dsr', isv4=True)
+
+ finally:
+ for asid in self.ass:
+ self.vapi.cli("lb as 90.0.0.0/8 10.0.0.%u del" % (asid))
+ self.vapi.cli("lb vip 90.0.0.0/8 encap l3dsr dscp 7 del")
+ self.vapi.cli("test lb flowtable flush")
+
+ def test_lb_ip4_nat4(self):
+ """ Load Balancer IP4 NAT4 """
+ try:
+ self.vapi.cli("lb vip 90.0.0.0/8 encap nat4"
+ " type clusterip port 3306 target_port 3307")
+ for asid in self.ass:
+ self.vapi.cli("lb as 90.0.0.0/8 10.0.0.%u" % (asid))
+
+ self.pg0.add_stream(self.generatePackets(self.pg0, isv4=True))
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+ self.checkCapture(encap='nat4', isv4=True)
+
+ finally:
+ for asid in self.ass:
+ self.vapi.cli("lb as 90.0.0.0/8 10.0.0.%u del" % (asid))
+ self.vapi.cli("lb vip 90.0.0.0/8 encap nat4"
+ " type clusterip port 3306 target_port 3307 del")
+ self.vapi.cli("test lb flowtable flush")
+
+ def test_lb_ip6_nat6(self):
+ """ Load Balancer IP6 NAT6 """
+ try:
+ self.vapi.cli("lb vip 2001::/16 encap nat6"
+ " type clusterip port 3306 target_port 3307")
+ for asid in self.ass:
+ self.vapi.cli("lb as 2001::/16 2002::%u" % (asid))
+
+ self.pg0.add_stream(self.generatePackets(self.pg0, isv4=False))
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+ self.checkCapture(encap='nat6', isv4=False)
+
+ finally:
+ for asid in self.ass:
+ self.vapi.cli("lb as 2001::/16 2002::%u del" % (asid))
+ self.vapi.cli("lb vip 2001::/16 encap nat6"
+ " type clusterip port 3306 target_port 3307 del")
+ self.vapi.cli("test lb flowtable flush")