Home › Forums › FABRIC General Questions and Discussion › Reserving P4 switch fails
- This topic has 1 reply, 2 voices, and was last updated 1 day, 12 hours ago by
Komal Thareja.
-
AuthorPosts
-
June 18, 2026 at 10:23 am #9865
Hello,
I’m trying to reserve a P4 switch and get an error.
My project ID is 5f00e1ce-d082-4a2b-b08f-889658e932b7.
It has Switch.P4 tag. There is another slice on the project (not mine) that reserved the switch.
Here’s my Jupyter Notebook code:
slice_name = 'My_TOFINO_slice_3' site_name = 'MICH' num_workers = 6 # Tofino gives 8 ports: master + client + 6 workers try: slice = fablib.get_slice(slice_name) slice.list_nodes() print('Done retrieving existing slice') except Exception as e: print(f'Creating new slice: {slice_name}') print(f'Previous error: {e}') slice = fablib.new_slice(name=slice_name) vm_names = ['master', 'client'] + [f'node{i}' for i in range(1, num_workers + 1)] for vm_name in vm_names: node = slice.add_node( name=vm_name, site=site_name, image='default_ubuntu_20' ) node.set_capacities(cores=2, ram=6, disk=10) node.add_component(model='NIC_Basic', name='if1') p4switch = slice.add_switch( name='p4switch', site=site_name ) sw_ifaces = p4switch.get_interfaces() print("Tofino switch interfaces:") for idx, iface in enumerate(sw_ifaces): print(idx, iface.get_name()) needed_ports = 2 + num_workers if len(sw_ifaces) < needed_ports: raise Exception(f"Need {needed_ports} switch interfaces, found {len(sw_ifaces)}") links = {} links['ms'] = slice.add_l2network(name='ms') links['ms'].add_interface(slice.get_node('master').get_interface('master-if1-p1')) links['ms'].add_interface(sw_ifaces[0]) links['cs'] = slice.add_l2network(name='cs') links['cs'].add_interface(slice.get_node('client').get_interface('client-if1-p1')) links['cs'].add_interface(sw_ifaces[1]) for i in range(1, num_workers + 1): link_name = f'n{i}s' links[link_name] = slice.add_l2network(name=link_name) host = slice.get_node(f'node{i}') links[link_name].add_interface(host.get_interface(f'node{i}-if1-p1')) links[link_name].add_interface(sw_ifaces) slice.submit() print(f"Slice '{slice_name}' created and submitted.")Screenshot for with the errors is attached.
Thanks.
June 18, 2026 at 3:28 pm #9870Hi Garegin,
There are only 5 P4 switches on the testbed, and right now all of them are in use, which is why you’re seeing the “Insufficient Resources” error.
To check which sites have a P4 switch available, you can use this snippet:
# Show all sites with P4 availability fields = ['name', 'state', "p4-switch_available"] hosts_table = fablib.list_sites( output='pandas', fields=fields, force_refresh=True, filter_function=lambda x: x['state'] == 'Active' )I checked just now and none are currently available. The UCSD P4 switch frees up on 2026-06-22, so you may want to set up an advanced reservation for it.
Best,
Komal
-
AuthorPosts
- You must be logged in to reply to this topic.