예제 #1
0
print(r)

if_1_sw_if_index = vpp.sw_interface_dump(name_filter_valid=1,
                                         name_filter=if_1_name)[0].sw_if_index
if_2_sw_if_index = vpp.sw_interface_dump(name_filter_valid=1,
                                         name_filter=if_2_name)[0].sw_if_index
if_3_sw_if_index = vpp.sw_interface_dump(name_filter_valid=1,
                                         name_filter=if_3_name)[0].sw_if_index

# add port-mirroring as available flowtable next node
r = vpp.add_node_next(node_name='flowtable-process', next_name='pm-hit')
print(r)
portmirroring_index = r.node_index

# configure portmirroring
r = vpp.pm_conf(dst_interface=if_3_sw_if_index, is_del=0)
print(r)

# hook on the first interface
# leave flows_max untouched
r = vpp.flowtable_conf(flows_max=0xffffffff,
                       sw_if_index=if_1_sw_if_index,
                       next_node_index=portmirroring_index,
                       enable_disable=0)
print(r)

# hook on the second interface
# leave flows_max untouched
r = vpp.flowtable_conf(flows_max=0xffffffff,
                       sw_if_index=if_2_sw_if_index,
                       next_node_index=portmirroring_index,
예제 #2
0
if_1_sw_if_index = vpp.sw_interface_dump(name_filter_valid=1,
                                         name_filter=if_1_name)[0].sw_if_index
if_2_sw_if_index = vpp.sw_interface_dump(name_filter_valid=1,
                                         name_filter=if_2_name)[0].sw_if_index
if_3_sw_if_index = vpp.sw_interface_dump(name_filter_valid=1,
                                         name_filter=if_3_name)[0].sw_if_index

# add port-mirroring as available flowtable next node
r = vpp.add_node_next(node_name='flowtable-process', next_name='pm-in-hit')
print(r)
portmirroring_index = r.node_index

# configure portmirroring
# 1 = flowtable, 0 = is_add
r = vpp.pm_conf(dst_interface=if_3_sw_if_index, from_node=1, is_del=0)
print(r)

r = vpp.flowtable_conf(flows_max=0xffffffff,
                       sw_if_index=if_1_sw_if_index,
                       next_node_index=portmirroring_index,
                       enable_disable=0)
print(r)
r = vpp.flowtable_conf(flows_max=0xffffffff,
                       sw_if_index=if_2_sw_if_index,
                       next_node_index=portmirroring_index,
                       enable_disable=0)
print(r)

r = vpp.disconnect()
exit(r)