本文整理汇总了Python中vpp_ip_route.VppIpRoute.add_vpp_config方法的典型用法代码示例。如果您正苦于以下问题:Python VppIpRoute.add_vpp_config方法的具体用法?Python VppIpRoute.add_vpp_config怎么用?Python VppIpRoute.add_vpp_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vpp_ip_route.VppIpRoute
的用法示例。
在下文中一共展示了VppIpRoute.add_vpp_config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ip6_rx_p2p_subif_route
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_ip6_rx_p2p_subif_route(self):
"""route rx ip6 packet not matching p2p subinterface"""
self.logger.info("FFP_TEST_START_0003")
self.pg0.config_ip6()
route_3 = VppIpRoute(self, "9000::", 64,
[VppRoutePath(self.pg1._remote_hosts[0].ip6,
self.pg1.sw_if_index,
proto=DpoProto.DPO_PROTO_IP6)],
is_ip6=1)
route_3.add_vpp_config()
self.packets.append(
self.create_stream(src_mac="02:03:00:00:ff:ff",
dst_mac=self.pg0.local_mac,
src_ip="a000::100",
dst_ip="9000::100"))
self.send_packets(self.pg0, self.pg1)
self.pg0.unconfig_ip6()
route_3.remove_vpp_config()
self.logger.info("FFP_TEST_FINISH_0003")
示例2: test_tcp_transfer
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_tcp_transfer(self):
""" TCP echo client/server transfer """
# Add inter-table routes
ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
[VppRoutePath("0.0.0.0",
0xffffffff,
nh_table_id=1)])
ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
[VppRoutePath("0.0.0.0",
0xffffffff,
nh_table_id=0)], table_id=1)
ip_t01.add_vpp_config()
ip_t10.add_vpp_config()
# Start builtin server and client
uri = "tcp://" + self.loop0.local_ip4 + "/1234"
error = self.vapi.cli("test echo server appns 0 fifo-size 4 uri " +
uri)
if error:
self.logger.critical(error)
self.assertNotIn("failed", error)
error = self.vapi.cli("test echo client mbytes 10 appns 1 " +
"fifo-size 4 no-output test-bytes " +
"syn-timeout 2 uri " + uri)
if error:
self.logger.critical(error)
self.assertNotIn("failed", error)
# Delete inter-table routes
ip_t01.remove_vpp_config()
ip_t10.remove_vpp_config()
示例3: test_quic_transfer
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_quic_transfer(self):
""" QUIC echo client/server transfer """
# Add inter-table routes
ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
[VppRoutePath("0.0.0.0",
0xffffffff,
nh_table_id=2)], table_id=1)
ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
[VppRoutePath("0.0.0.0",
0xffffffff,
nh_table_id=1)], table_id=2)
ip_t01.add_vpp_config()
ip_t10.add_vpp_config()
self.logger.debug(self.vapi.cli("show ip fib"))
# Start builtin server and client
uri = "quic://%s/1234" % self.loop0.local_ip4
error = self.vapi.cli("test echo server appns 1 fifo-size 4 uri %s" %
uri)
if error:
self.logger.critical(error)
self.assertNotIn("failed", error)
error = self.vapi.cli("test echo client bytes 1024 appns 2 " +
"fifo-size 4 test-bytes no-output " +
"uri %s" % uri)
self.logger.critical(error)
if error:
self.logger.critical(error)
self.assertNotIn("failed", error)
# Delete inter-table routes
ip_t01.remove_vpp_config()
ip_t10.remove_vpp_config()
示例4: setup_tunnel
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def setup_tunnel(self):
# IPv6 transport
rv = self.vapi.ipip_add_tunnel(
src_address=self.pg0.local_ip6n,
dst_address=self.pg1.remote_ip6n, tc_tos=255)
sw_if_index = rv.sw_if_index
self.tunnel_if_index = sw_if_index
self.vapi.sw_interface_set_flags(sw_if_index, 1)
self.vapi.sw_interface_set_unnumbered(
sw_if_index=self.pg0.sw_if_index,
unnumbered_sw_if_index=sw_if_index)
# Add IPv4 and IPv6 routes via tunnel interface
ip4_via_tunnel = VppIpRoute(
self, "130.67.0.0", 16,
[VppRoutePath("0.0.0.0",
sw_if_index,
proto=DpoProto.DPO_PROTO_IP4)], is_ip6=0)
ip4_via_tunnel.add_vpp_config()
ip6_via_tunnel = VppIpRoute(
self, "dead::", 16,
[VppRoutePath("::",
sw_if_index,
proto=DpoProto.DPO_PROTO_IP6)], is_ip6=1)
ip6_via_tunnel.add_vpp_config()
self.tunnel_ip6_via_tunnel = ip6_via_tunnel
self.tunnel_ip4_via_tunnel = ip4_via_tunnel
示例5: test_PPPoE_Del_Twice
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_PPPoE_Del_Twice(self):
""" PPPoE Delete Same Session Twice Test """
self.vapi.cli("clear trace")
#
# Add a route that resolves the server's destination
#
route_sever_dst = VppIpRoute(self, "100.1.1.100", 32,
[VppRoutePath(self.pg1.remote_ip4,
self.pg1.sw_if_index)])
route_sever_dst.add_vpp_config()
# Send PPPoE Discovery
tx0 = self.create_stream_pppoe_discovery(self.pg0, self.pg1,
self.pg0.remote_mac)
self.pg0.add_stream(tx0)
self.pg_start()
# Send PPPoE PPP LCP
tx1 = self.create_stream_pppoe_lcp(self.pg0, self.pg1,
self.pg0.remote_mac,
self.session_id)
self.pg0.add_stream(tx1)
self.pg_start()
# Create PPPoE session
pppoe_if = VppPppoeInterface(self,
self.pg0.remote_ip4,
self.pg0.remote_mac,
self.session_id)
pppoe_if.add_vpp_config()
# Delete PPPoE session
pppoe_if.remove_vpp_config()
#
# The double del (del the same session twice) should fail,
# and we should still be able to use the original
#
try:
pppoe_if.remove_vpp_config()
except Exception:
pass
else:
self.fail("Double GRE tunnel del does not fail")
#
# test case cleanup
#
# Delete a route that resolves the server's destination
route_sever_dst.remove_vpp_config()
示例6: test_6rd_bgp_tunnel
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_6rd_bgp_tunnel(self):
""" 6rd BGP tunnel """
rv = self.vapi.ipip_6rd_add_tunnel(0, 0, inet_pton(AF_INET6, '2002::'),
inet_pton(AF_INET, '0.0.0.0'),
self.pg0.local_ip4n, 16, 0, False)
self.tunnel_index = rv.sw_if_index
default_route = VppIpRoute(
self, "DEAD::", 16, [VppRoutePath("2002:0808:0808::",
self.tunnel_index,
proto=DpoProto.DPO_PROTO_IP6)],
is_ip6=1)
default_route.add_vpp_config()
ip4_route = VppIpRoute(self, "8.0.0.0", 8,
[VppRoutePath(self.pg1.remote_ip4, 0xFFFFFFFF)])
ip4_route.add_vpp_config()
# Via recursive route 6 -> 4
p = (Ether(src=self.pg0.remote_mac,
dst=self.pg0.local_mac) /
IPv6(src="1::1", dst="DEAD:BEEF::1") /
UDP(sport=1234, dport=1234))
p_reply = (IP(src=self.pg0.local_ip4, dst="8.8.8.8",
proto='ipv6') /
IPv6(src='1::1', dst='DEAD:BEEF::1', nh='UDP'))
rx = self.send_and_expect(self.pg0, p * 10, self.pg1)
for p in rx:
self.validate_6in4(p, p_reply)
# Via recursive route 4 -> 6 (Security check must be disabled)
p_ip6 = (IPv6(src="DEAD:BEEF::1", dst=self.pg1.remote_ip6) /
UDP(sport=1234, dport=1234))
p = (Ether(src=self.pg0.remote_mac,
dst=self.pg0.local_mac) /
IP(src="8.8.8.8", dst=self.pg0.local_ip4) /
p_ip6)
p_reply = p_ip6
rx = self.send_and_expect(self.pg0, p * 10, self.pg1)
for p in rx:
self.validate_4in6(p, p_reply)
ip4_route.remove_vpp_config()
default_route.remove_vpp_config()
self.vapi.ipip_6rd_del_tunnel(self.tunnel_index)
示例7: test_no_p2p_subif
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_no_p2p_subif(self):
"""standard routing without p2p subinterfaces"""
self.logger.info("FFP_TEST_START_0001")
route_8000 = VppIpRoute(self, "8000::", 64,
[VppRoutePath(self.pg0.remote_ip6,
self.pg0.sw_if_index,
proto=DpoProto.DPO_PROTO_IP6)],
is_ip6=1)
route_8000.add_vpp_config()
self.packets = [(Ether(dst=self.pg1.local_mac,
src=self.pg1.remote_mac) /
IPv6(src="3001::1", dst="8000::100") /
UDP(sport=1234, dport=1234) /
Raw('\xa5' * 100))]
self.send_packets(self.pg1, self.pg0)
self.logger.info("FFP_TEST_FINISH_0001")
示例8: test_ip4_rx_p2p_subif_route
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_ip4_rx_p2p_subif_route(self):
"""route rx packet not matching p2p subinterface"""
self.logger.info("FFP_TEST_START_0003")
route_9001 = VppIpRoute(self, "9.0.0.0", 24,
[VppRoutePath(self.pg1.remote_ip4,
self.pg1.sw_if_index)])
route_9001.add_vpp_config()
self.packets.append(
self.create_stream(src_mac="02:01:00:00:ff:ff",
dst_mac=self.pg0.local_mac,
src_ip="8.0.0.100",
dst_ip="9.0.0.100"))
self.send_packets(self.pg0, self.pg1)
route_9001.remove_vpp_config()
self.logger.info("FFP_TEST_FINISH_0003")
示例9: test_ip6_rx_p2p_subif_drop
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_ip6_rx_p2p_subif_drop(self):
"""drop rx packet not matching p2p subinterface"""
self.logger.info("FFP_TEST_START_0004")
route_9001 = VppIpRoute(self, "9000::", 64,
[VppRoutePath(self.pg1._remote_hosts[0].ip6,
self.pg1.sw_if_index,
proto=DpoProto.DPO_PROTO_IP6)],
is_ip6=1)
route_9001.add_vpp_config()
self.packets.append(
self.create_stream(src_mac="02:03:00:00:ff:ff",
dst_mac=self.pg0.local_mac,
src_ip="a000::100",
dst_ip="9000::100"))
# no packet received
self.send_packets(self.pg0, self.pg1, count=0)
self.logger.info("FFP_TEST_FINISH_0004")
示例10: test_ip4_rx_p2p_subif
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_ip4_rx_p2p_subif(self):
"""receive ipv4 packet via p2p subinterface"""
self.logger.info("FFP_TEST_START_0002")
route_9000 = VppIpRoute(self, "9.0.0.0", 16,
[VppRoutePath(self.pg1.remote_ip4,
self.pg1.sw_if_index)])
route_9000.add_vpp_config()
self.packets.append(
self.create_stream(src_mac=self.pg0._remote_hosts[0].mac,
dst_mac=self.pg0.local_mac,
src_ip=self.p2p_sub_ifs[0].remote_ip4,
dst_ip="9.0.0.100"))
self.send_packets(self.pg0, self.pg1, self.packets)
self.assert_packet_counter_equal('p2p-ethernet-input', 1)
route_9000.remove_vpp_config()
self.logger.info("FFP_TEST_FINISH_0002")
示例11: test_gre_loop
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_gre_loop(self):
""" GRE tunnel loop Tests """
#
# Create an L3 GRE tunnel.
# - set it admin up
# - assign an IP Addres
#
gre_if = VppGreInterface(self,
self.pg0.local_ip4,
"1.1.1.2")
gre_if.add_vpp_config()
gre_if.admin_up()
gre_if.config_ip4()
#
# add a route to the tunnel's destination that points
# through the tunnel, hence forming a loop in the forwarding
# graph
#
route_dst = VppIpRoute(self, "1.1.1.2", 32,
[VppRoutePath("0.0.0.0",
gre_if.sw_if_index)])
route_dst.add_vpp_config()
#
# packets to the tunnels destination should be dropped
#
tx = self.create_stream_ip4(self.pg0, "1.1.1.1", "1.1.1.2")
self.send_and_assert_no_replies(self.pg2, tx)
self.logger.info(self.vapi.ppcli("sh adj 7"))
#
# break the loop
#
route_dst.modify([VppRoutePath(self.pg1.remote_ip4,
self.pg1.sw_if_index)])
route_dst.add_vpp_config()
rx = self.send_and_expect(self.pg0, tx, self.pg1)
#
# a good route throught the tunnel to check it restacked
#
route_via_tun_2 = VppIpRoute(self, "2.2.2.2", 32,
[VppRoutePath("0.0.0.0",
gre_if.sw_if_index)])
route_via_tun_2.add_vpp_config()
tx = self.create_stream_ip4(self.pg0, "2.2.2.3", "2.2.2.2")
rx = self.send_and_expect(self.pg0, tx, self.pg1)
self.verify_tunneled_4o4(self.pg1, rx, tx,
self.pg0.local_ip4, "1.1.1.2")
#
# cleanup
#
route_via_tun_2.remove_vpp_config()
gre_if.remove_vpp_config()
示例12: test_ip4_tx_p2p_subif
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_ip4_tx_p2p_subif(self):
"""send ip4 packet via p2p subinterface"""
self.logger.info("FFP_TEST_START_0005")
route_9100 = VppIpRoute(self, "9.1.0.100", 24,
[VppRoutePath(self.pg0.remote_ip4,
self.pg0.sw_if_index,
)])
route_9100.add_vpp_config()
route_9200 = VppIpRoute(self, "9.2.0.100", 24,
[VppRoutePath(self.p2p_sub_ifs[0].remote_ip4,
self.p2p_sub_ifs[0].sw_if_index,
)])
route_9200.add_vpp_config()
route_9300 = VppIpRoute(self, "9.3.0.100", 24,
[VppRoutePath(self.p2p_sub_ifs[1].remote_ip4,
self.p2p_sub_ifs[1].sw_if_index
)])
route_9300.add_vpp_config()
for i in range(0, 3):
self.packets.append(
self.create_stream(src_mac=self.pg1.remote_mac,
dst_mac=self.pg1.local_mac,
src_ip=self.pg1.remote_ip4,
dst_ip="9.%d.0.100" % (i+1)))
self.send_packets(self.pg1, self.pg0)
# route_7000.remove_vpp_config()
route_9100.remove_vpp_config()
route_9200.remove_vpp_config()
route_9300.remove_vpp_config()
self.logger.info("FFP_TEST_FINISH_0005")
示例13: test_ip6_rx_p2p_subif
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_ip6_rx_p2p_subif(self):
"""receive ipv6 packet via p2p subinterface"""
self.logger.info("FFP_TEST_START_0002")
route_9001 = VppIpRoute(self, "9001::", 64,
[VppRoutePath(self.pg1.remote_ip6,
self.pg1.sw_if_index,
proto=DpoProto.DPO_PROTO_IP6)],
is_ip6=1)
route_9001.add_vpp_config()
self.packets.append(
self.create_stream(src_mac=self.pg0._remote_hosts[0].mac,
dst_mac=self.pg0.local_mac,
src_ip=self.p2p_sub_ifs[0].remote_ip6,
dst_ip="9001::100"))
self.send_packets(self.pg0, self.pg1, self.packets)
self.assert_packet_counter_equal('p2p-ethernet-input', 1)
route_9001.remove_vpp_config()
self.logger.info("FFP_TEST_FINISH_0002")
示例14: config_network
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def config_network(self, params):
self.net_objs = []
self.tun_if = self.pg0
self.tra_if = self.pg2
self.logger.info(self.vapi.ppcli("show int addr"))
self.tra_spd = VppIpsecSpd(self, self.tra_spd_id)
self.tra_spd.add_vpp_config()
self.net_objs.append(self.tra_spd)
self.tun_spd = VppIpsecSpd(self, self.tun_spd_id)
self.tun_spd.add_vpp_config()
self.net_objs.append(self.tun_spd)
b = VppIpsecSpdItfBinding(self, self.tra_spd,
self.tra_if)
b.add_vpp_config()
self.net_objs.append(b)
b = VppIpsecSpdItfBinding(self, self.tun_spd,
self.tun_if)
b.add_vpp_config()
self.net_objs.append(b)
for p in params:
self.config_ah_tra(p)
config_tra_params(p, self.encryption_type)
for p in params:
self.config_ah_tun(p)
for p in params:
d = DpoProto.DPO_PROTO_IP6 if p.is_ipv6 else DpoProto.DPO_PROTO_IP4
r = VppIpRoute(self, p.remote_tun_if_host, p.addr_len,
[VppRoutePath(self.tun_if.remote_addr[p.addr_type],
0xffffffff,
proto=d)],
is_ip6=p.is_ipv6)
r.add_vpp_config()
self.net_objs.append(r)
self.logger.info(self.vapi.ppcli("show ipsec all"))
示例15: test_segment_manager_alloc
# 需要导入模块: from vpp_ip_route import VppIpRoute [as 别名]
# 或者: from vpp_ip_route.VppIpRoute import add_vpp_config [as 别名]
def test_segment_manager_alloc(self):
""" Session Segment Manager Multiple Segment Allocation """
# Add inter-table routes
ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
[VppRoutePath("0.0.0.0",
0xffffffff,
nh_table_id=1)])
ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
[VppRoutePath("0.0.0.0",
0xffffffff,
nh_table_id=0)], table_id=1)
ip_t01.add_vpp_config()
ip_t10.add_vpp_config()
# Start builtin server and client with small private segments
uri = "tcp://" + self.loop0.local_ip4 + "/1234"
error = self.vapi.cli("test echo server appns 0 fifo-size 64 " +
"private-segment-size 1m uri " + uri)
if error:
self.logger.critical(error)
self.assertNotIn("failed", error)
error = self.vapi.cli("test echo client nclients 100 appns 1 " +
"no-output fifo-size 64 syn-timeout 2 " +
"private-segment-size 1m uri " + uri)
if error:
self.logger.critical(error)
self.assertNotIn("failed", error)
if self.vpp_dead:
self.assert_equal(0)
# Delete inter-table routes
ip_t01.remove_vpp_config()
ip_t10.remove_vpp_config()