Forum Replies Created
-
AuthorPosts
-
Yeah, this is all correct. The issue here is that some components have multiple interfaces. At the same time, interfaces need unique names. When you name a component that has interfaces, the interface names will be {{node name}}-{{component name}}-p1, {{node name}}-{{component name}}-p2, …
Also, components need unique names so the specified component name is prepended with the node name.
This is all a bit awkward but its a trade off between this and requiring the user to navigate a bunch of errors when trying to assign names to all their objects.
We are considering adding some additional methods that automatically create/parse the names so that the user can use only the names they specified. Of course this would mean that if you issued a mySlice.get_interface(name=”myInterface”) there may be a list of interfaces with that name but from different components and nodes. This may be a better way to go.
Your input on the topic would be welcome.
Paul
You will need to contact your project leader and have them add you to the project. Which project are you trying join?
Most of the library functionality that sets internal configuration of the VMs is just a wrapper around SSH (actually paramiko). We can, and will, add more helper functions like these but there will always be some configuration that we do not anticipate.
You can, however, make arbitrary config like this:
myNode.execute("sudo ip link set dev eth1 mtu 9000")
You can even dynamically create the command to get the device names like this:
myiface = myNode.get_interface(network_name='myNetwork') myNode.execute(f"sudo ip link set dev {myiface..get_os_interface()} mtu 9000")
There is an example of creating similar commands in this notebook: https://github.com/fabric-testbed/jupyter-examples/blob/master/fabric_examples/fablib_api/create_l2network_basic_tagged.ipynb
Note that some time soon we will update the config to use NetworkManager inside the VMs. When this happens you will need to either use NetworkManager to configure the VMs or turn network manager off before issuing ‘ip’ commands. The benefit of NetworkManager is that changes will live through the VM being rebooted.
I think the error is that it is trying to overwrite the /home/ubuntu dir in the VM. Try including the file name in the remote path like this:
node1.upload_file(local_file_path=os.environ[‘HOME’]+’/work/Server.py’, remote_file_path=’/home/ubuntu/Server.py’)
Yes, look at the “node.upload_file()” method.
You can do the following:
my_node.upload_file(local_file_path='/path/to/file/in/jupyter/environment', remote_file_path='/destination/path/to/file/in/vm')
There is also a ‘download_file’ method and many more extras in FABlib. Checkout the Sphinx docs: https://learn.fabric-testbed.net/docs/fablib/fablib.html
- This reply was modified 2 years, 5 months ago by Paul Ruth.
There are few different images available. Ubuntu20 is one that is commonly used although 18, 21, and 22 are also available.
The example notebook called “Create Node” shows some extra parameters that can be used to customize a node. That notebook is in your JupyterHub container but you can also reference it here: https://github.com/fabric-testbed/jupyter-examples/blob/master/fabric_examples/fablib_api/create_node.ipynb
You just need to add a parameter to the call to
slice.add_node()
like this:node = slice.add_node(name='Node1', image='default_ubuntu_20')
We currently do not support uploading custom images. We might support it in the future. However, it is easy to create a notebook that automates starting a slice and running the
node.execute()
method to configure the nodes. We are working on some example notebooks the demonstrate best practices in deploying and configuring slices but they are not ready yet.Paul
This is likely due to an update to the FABRIC control framework software that now requires you to specify the ID of the project that you want to use to create your slice. We understand that this error message is not very descriptive and are will update it soon.
Try adding the following to the first cell of your notebook:
os.environ[‘FABRIC_PROJECT_ID’]=<your_project_id>
The project ID can be found in the portal by selecting your project from the projects tab.
Also note that the example notebooks have been updated to include this environment variable. You may want to update your examples notebooks. The easiest way to do this is to delete the jupyter-examples folder in your Jupyter container and then stop/start your container (select File->Hub Control Panel)
Paul
I think the issue is that we have moved to a more formal release mechanism for fabrictestbed-extensions. I think the main branch is a bit ahead of what you should be using (and apparently broken). Try pulling release 1.2 instead of the main branch (https://github.com/fabric-testbed/fabrictestbed-extensions/releases)
Alternatively, you can pull from pypi directly with:
pip install fabrictestbed-extensions
I think the instructions need to be updated to point to the pypi release.
Are you able to repeat this consistently? I can’t seem to reproduce it.
The error you are seeing is that a control framework does not have a management IP for the VM (or does not yet have a management IP for the VM) at a time when the library is trying to ssh to it.
I think this might be a transient issue that has to do with a VM that was not issues a management IP.
Let us know if you continue to be able to repeat it.
That is a great question and we have been working on this.
The short answer is that the library as a whole is probably not thread safe. However, the”node.execute()” method is really just a wrapper around a paramiko call and can be thread safe. Also most of the “get” methods should be thread safe.
We have very rough (but working) version of a threaded execute call in a coming branch of fablib. It’s not in its final form and interface will probably be simplified so I wouldn’t build too much based on this branch. However, you could look at what we have and implement a small wrapper in you notebook that will accomplish your goal.
You can look here to see how we got the initial version to work: https://github.com/fabric-testbed/fabrictestbed-extensions/blob/fablib1.1.4dev1/fabrictestbed_extensions/fablib/node.py#:~:text=def-,execute_thread,-(self%2C
One of the changes I want to make is to have a pool of theads. Here is an example of fablib using a thread pool to get the interface names of from the VMs: https://github.com/fabric-testbed/fabrictestbed-extensions/blob/1.2rc12+-pruth-working/fabrictestbed_extensions/fablib/slice.py#:~:text=def-,list_interfaces,-(self)%3A
Use these only as examples because they are not really ready for users, but they both work and I expect you can pull some ideas from them.
Paul
Ah, I didn’t read carefully enough. We will need to add that in the next version. I will add that to the list.
thanks,
Paul
The last section of the first cell of any example notebook has the following commented out. Uncomment it or set FABRIC_SLICE_PRIVATE_KEY_PASSPHRASE in anyway you wish.
# If your slice private key uses a passphrase, set the passphrase from getpass import getpass print('Please input private key passphrase. Press enter for no passphrase.') os.environ['FABRIC_SLICE_PRIVATE_KEY_PASSPHRASE']=getpass()
Soon we will update FABlib to allow you to set these directly but for now you just need to set the env var.
I wonder if this has to do with the project you just created. We just added some permission limiting to the projects and yours has the default (i.e. minimal permissions).
I just added you to the “FABRIC Tutorial” project. Try using that one and see if that works.
Paul
Ah… you need to think about a Jupyter notebook like a live Python app that is that is in a debugger. Even if you go back the the top cell, all the values remain. If you want to reset all the vars and env vars (i.e. if you comment out the token path), then you need to restart the notebook kernel. Otherwise residual values will be in subsequent runs.
Try setting all the tokens values, then restarting the notebook’s kernel, then start from the top.
Also, the example notebooks are automatically pulled from the following link when you start your JupyterHub container.
https://github.com/fabric-testbed/jupyter-examples
If you want to fully reset your JupyterHub container you can “rm -rf ~/work/jupyter-examples”, then stop/start your container (File->Hub Control Panel), then log out/in.
Restarting the container with a missing ~/work/jupyter-examples dir will re-pull the github repo. Logging out/in will get a new token.
Of course, you can do all that manually by using git commands and pulling a new token from the portal.
-
AuthorPosts