示例#1
0
    def test_dump_details_function(self):
        vpp = VPP(jsonfiles)
        vpp.connect('test_vpp_papi3')

        rv = vpp.sw_interface_dump()
        #self.assertEqual(0, rv.retval)
        print('RV', rv)
        vpp.disconnect()
示例#2
0
    for filename in fnmatch.filter(filenames, '*.api.json'):
        jsonfiles.append(os.path.join(vpp_json_dir, filename))

if not jsonfiles:
    print('Error: no json api files found')
    exit(-1)

vpp = VPP(jsonfiles)

if_1_name = 'tap-0'
if_2_name = 'tap-1'

r = vpp.connect('papi')
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

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

# hook on the second interface
# leave flows_max and next_node_index untouched
r = vpp.flowtable_conf(flows_max=0xffffffff,
                       sw_if_index=if_2_sw_if_index,