1. Set link characteristics

Set link characteristics

Home Forums FABRIC General Questions and Discussion Set link characteristics

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2213
    Arash SARABI
    Participant

      In our experiment, each link may have a different delay, delay variation, and packet loss ratio.
      I was wondering if it was possible to set these variables on the Jupyter notebook (links property) rather than on the nodes.

      Thank you

       

      • This topic was modified 2 years, 5 months ago by Arash SARABI.
      #2215
      Paul Ruth
      Keymaster

        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.

         

        #2223
        Arash SARABI
        Participant

          Thank you for all your help,

          How can I use Bash “magic”? when I try to use the following command it returns an error.

          %%bash -s “$FABRIC_SLICE_PRIVATE_KEY_FILE” “$FABRIC_BASTION_USERNAME” “$FABRIC_BASTION_HOST” “$ROMEO_USER” “$ROMEO_IP”
          ssh -q -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=/dev/null -i $1 -J $2@$3 $4@$5 << EOF
          ##############################################

          echo ‘Hello from:’; hostname

          ##############################################
          exit
          EOF

           

          Here is the error:

          Warning: Permanently added ‘bastion-1.fabric-testbed.net,152.54.15.12’ (ECDSA) to the list of known hosts.

          —————————————————————————
          CalledProcessError Traceback (most recent call last)
          /tmp/ipykernel_864/42773540.py in <module>
          —-> 1 get_ipython().run_cell_magic(‘bash’, ‘-s “$FABRIC_SLICE_PRIVATE_KEY_FILE” “$FABRIC_BASTION_USERNAME” “$FABRIC_BASTION_HOST” “$ROMEO_USER” “$ROMEO_IP”‘, “ssh -q -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=/dev/null -i $1 -J $2@$3 $4@$5 << EOF\n##############################################\n\necho ‘Hello from:’; hostname\n\n##############################################\nexit\nEOF\n”)

          /opt/conda/lib/python3.9/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
          2401 with self.builtin_trap:
          2402 args = (magic_arg_s, cell)
          -> 2403 result = fn(*args, **kwargs)
          2404 return result
          2405

          /opt/conda/lib/python3.9/site-packages/IPython/core/magics/script.py in named_script_magic(line, cell)
          140 else:
          141 line = script
          –> 142 return self.shebang(line, cell)
          143
          144 # write a basic docstring:

          <decorator-gen-103> in shebang(self, line, cell)

          /opt/conda/lib/python3.9/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
          185 # but it’s overkill for just that one bit of state.
          186 def magic_deco(arg):
          –> 187 call = lambda f, *a, **k: f(*a, **k)
          188
          189 if callable(arg):

          /opt/conda/lib/python3.9/site-packages/IPython/core/magics/script.py in shebang(self, line, cell)
          243 sys.stderr.flush()
          244 if args.raise_error and p.returncode!=0:
          –> 245 raise CalledProcessError(p.returncode, cell, output=out, stderr=err)
          246
          247 def _run_script(self, p, cell, to_close):

          CalledProcessError: Command ‘b”ssh -q -o StrictHostKeyChecking=accept-new -o UserKnownHostsFile=/dev/null -i $1 -J $2@$3 $4@$5 << EOF\n##############################################\n\necho ‘Hello from:’; hostname\n\n##############################################\nexit\nEOF\n”‘ returned non-zero exit status 255.

          #2224
          Arash SARABI
          Participant

            I fixed the issue. Thank you

            #3306
            ilknur Aydin
            Participant

              how did you fix the issue?

              #3307
              ilknur Aydin
              Participant

                I have this command

                %%bash -s “$FABRIC_SLICE_PRIVATE_KEY_FILE” “$FABRIC_BASTION_USERNAME” “$FABRIC_BASTION_HOST” “$ROUTER1_USER” “$ROUTER1_IP” “$router1Cmd”
                ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i $1 -J $2@$3 $4@$5 << EOF
                ##############################################

                cd
                echo “hello” > hello.txt
                ##############################################
                exit
                EOF

                 

                 

                getting the following error, any comments on how to fix the issue or what the issue is?

                Host key verification failed.

                —————————————————————————
                CalledProcessError Traceback (most recent call last)
                /tmp/ipykernel_55/1667276590.py in <module>
                —-> 1 get_ipython().run_cell_magic(‘bash’, ‘-s “$FABRIC_SLICE_PRIVATE_KEY_FILE” “$FABRIC_BASTION_USERNAME” “$FABRIC_BASTION_HOST” “$ROUTER1_USER” “$ROUTER1_IP” “$router1Cmd”‘, ‘ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i $1 -J $2@$3 $4@$5 << EOF\n##############################################\n\ncd\necho “hello” > hello.txt\n##############################################\nexit\nEOF\n’)

                /opt/conda/lib/python3.9/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
                2404 with self.builtin_trap:
                2405 args = (magic_arg_s, cell)
                -> 2406 result = fn(*args, **kwargs)
                2407 return result
                2408

                /opt/conda/lib/python3.9/site-packages/IPython/core/magics/script.py in named_script_magic(line, cell)
                140 else:
                141 line = script
                –> 142 return self.shebang(line, cell)
                143
                144 # write a basic docstring:

                <decorator-gen-103> in shebang(self, line, cell)

                /opt/conda/lib/python3.9/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
                185 # but it’s overkill for just that one bit of state.
                186 def magic_deco(arg):
                –> 187 call = lambda f, *a, **k: f(*a, **k)
                188
                189 if callable(arg):

                /opt/conda/lib/python3.9/site-packages/IPython/core/magics/script.py in shebang(self, line, cell)
                243 sys.stderr.flush()
                244 if args.raise_error and p.returncode!=0:
                –> 245 raise CalledProcessError(p.returncode, cell, output=out, stderr=err)
                246
                247 def _run_script(self, p, cell, to_close):

                CalledProcessError: Command ‘b’ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i $1 -J $2@$3 $4@$5 << EOF\n##############################################\n\ncd\necho “hello” > hello.txt\n##############################################\nexit\nEOF\n” returned non-zero exit status 255.

              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.