diff --git a/.github/label-pr.yml b/.github/label-pr.yml new file mode 100644 index 0000000..540e35f --- /dev/null +++ b/.github/label-pr.yml @@ -0,0 +1,32 @@ +- regExp: ".*\\.ts+$" + labels: ["typescript"] +- regExp: ".*\\.sql+$" + labels: ["database", "critical"] +- regExp: ".*/docs/" + labels: ["documentation"] +- regExp: ".*\\.png+$" + labels: ["images"] +- regExp: "^(pom\\.xml|package\\.json|build\\.gradle)$" + labels: ["dependencies"] +- regExp: ".*/requirements.txt" + labels: ["dependencies"] +- regExp: ".*\\.(zip|jar|war|ear)+$" + labels: ["artifact", "invalid"] +- regExp: ".*/setup.py" + labels: ["build"] +- regExp: "^.github/" + labels: ["github-workflow"] +- regExp: "^nets/8r-1c-in-band-isis/" + labels: ["topology/8r-1c-in-band-isis"] +- regExp: "^nets/8routers-isis-ipv6/" + labels: ["topology/8routers-isis-ipv6"] +- regExp: "^nets-unmantained/8r-1c-out-band-isis/" + labels: ["topology/8r-1c-out-band-isis"] +- regExp: "^nets-unmantained/3routers/" + labels: ["topology/3routers"] +- regExp: "^nets-unmantained/8routers/" + labels: ["topology/8routers"] +- regExp: "^nets-in-progress/8r-1c-srv6-pm/" + labels: ["topology/8r-1c-srv6-pm"] +- regExp: ".*/.env" + labels: ["configuration"] diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml new file mode 100644 index 0000000..d44b184 --- /dev/null +++ b/.github/pr-labeler.yml @@ -0,0 +1,3 @@ +feature: ['feature/*', 'feat/*', 'feature-*', 'feat-*'] +bug: ['fix/*', 'fix-*'] +chore: ['chore/*', 'chore-*'] diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..b1f5fa5 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,36 @@ +name-template: 'v$RESOLVED_VERSION 🌈' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '🧰 Maintenance' + label: 'chore' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + - 'feature' + - 'enhancement' + patch: + labels: + - 'patch' + - 'fix' + - 'bugfix' + - 'bug' + default: patch +exclude-labels: + - 'skip-changelog' +template: | + ## Changes + $CHANGES diff --git a/.github/workflows/autopep8.yml b/.github/workflows/autopep8.yml new file mode 100644 index 0000000..a1f5a06 --- /dev/null +++ b/.github/workflows/autopep8.yml @@ -0,0 +1,42 @@ +name: autopep8 +on: pull_request +jobs: + autopep8: + # Check if the PR is not raised by this workflow and is not from a fork + if: startsWith(github.head_ref, 'autopep8-patches') == false && github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + steps: + - name: Set up Python 3 + uses: actions/setup-python@v2 + with: + python-version: 3 + - name: Checkout Code + uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel flake8 pytest + - name: autopep8 + id: autopep8 + uses: peter-evans/autopep8@v1 + with: + args: --exit-code --recursive --in-place --aggressive --aggressive . + - name: Set autopep8 branch name + id: vars + run: echo ::set-output name=branch-name::"autopep8-patches/$GITHUB_HEAD_REF" + - name: Create Pull Request + if: steps.autopep8.outputs.exit-code == 2 + uses: peter-evans/create-pull-request@v2 + with: + commit-message: autopep8 action fixes + committer: Carmine Scarpitta + title: Fixes by autopep8 action + body: This is an auto-generated PR with fixes by autopep8. + labels: autopep8, automated pr + reviewers: cscarpitta + branch: ${{ steps.vars.outputs.branch-name }} + - name: Fail if autopep8 made changes + if: steps.autopep8.outputs.exit-code == 2 + run: exit 1 diff --git a/.github/workflows/pr_labeler.yml b/.github/workflows/pr_labeler.yml new file mode 100644 index 0000000..6747698 --- /dev/null +++ b/.github/workflows/pr_labeler.yml @@ -0,0 +1,27 @@ +# Workflow to associate labels automatically +name: labeler + +# Trigger the workflow on pull request events +on: [pull_request] + +jobs: + label: + runs-on: ubuntu-latest + steps: + # We need to checkout the repository to access the configured file (.github/label-pr.yml) + - uses: actions/checkout@v2 + - name: Labeler + uses: docker://decathlon/pull-request-labeler-action:2.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Here we can override the path for the action configuration. If none is provided, default one is `.github/label-pr.yml` + # CONFIG_PATH: ${{ secrets.GITHUB_WORKSPACE }}/.github/label-pr.yml + + pr-labeler: + runs-on: ubuntu-latest + steps: + - uses: TimonVS/pr-labeler-action@v3 + # with: + # configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..9d39e16 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,19 @@ +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + # with: + # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml + # config-name: my-config.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/nets-in-progress/8r-1c-srv6-pm/isis8d.py b/nets-in-progress/8r-1c-srv6-pm/isis8d.py index 1a59fba..36b7fb0 100644 --- a/nets-in-progress/8r-1c-srv6-pm/isis8d.py +++ b/nets-in-progress/8r-1c-srv6-pm/isis8d.py @@ -20,7 +20,7 @@ from mininet.util import dumpNodeConnections # BASEDIR = "/home/user/mytests/ospf3routers/nodeconf/" -BASEDIR = os.getcwd()+"/nodeconf/" +BASEDIR = os.getcwd() + "/nodeconf/" OUTPUT_PID_TABLE_FILE = "/tmp/pid_table_file.txt" PRIVDIR = '/var/priv' @@ -72,9 +72,9 @@ def config(self, **kwargs): # first = False # self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name)) # let's write the hostname in /var/mininet/hostname - self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname") - if os.path.isfile(BASEDIR+self.name+"/start.sh"): - self.cmd('source %s' % BASEDIR+self.name+"/start.sh") + self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname") + if os.path.isfile(BASEDIR + self.name + "/start.sh"): + self.cmd('source %s' % BASEDIR + self.name + "/start.sh") def cleanup(self): def remove_if_exists(filename): @@ -86,13 +86,13 @@ def remove_if_exists(filename): if os.path.exists(self.dir): shutil.rmtree(self.dir) - remove_if_exists(BASEDIR+self.name+"/zebra.pid") - remove_if_exists(BASEDIR+self.name+"/zebra.log") - remove_if_exists(BASEDIR+self.name+"/zebra.sock") - remove_if_exists(BASEDIR+self.name+"/isis8d.pid") - remove_if_exists(BASEDIR+self.name+"/isis8d.log") - remove_if_exists(BASEDIR+self.name+"/isisd.log") - remove_if_exists(BASEDIR+self.name+"/isisd.pid") + remove_if_exists(BASEDIR + self.name + "/zebra.pid") + remove_if_exists(BASEDIR + self.name + "/zebra.log") + remove_if_exists(BASEDIR + self.name + "/zebra.sock") + remove_if_exists(BASEDIR + self.name + "/isis8d.pid") + remove_if_exists(BASEDIR + self.name + "/isis8d.log") + remove_if_exists(BASEDIR + self.name + "/isisd.log") + remove_if_exists(BASEDIR + self.name + "/isisd.pid") remove_if_exists(OUTPUT_PID_TABLE_FILE) @@ -153,9 +153,9 @@ def config(self, **kwargs): # first = False # self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name)) # let's write the hostname in /var/mininet/hostname - self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname") - if os.path.isfile(BASEDIR+self.name+"/start.sh"): - self.cmd('source %s' % BASEDIR+self.name+"/start.sh") + self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname") + if os.path.isfile(BASEDIR + self.name + "/start.sh"): + self.cmd('source %s' % BASEDIR + self.name + "/start.sh") def cleanup(self): # def remove_if_exists(filename): @@ -171,8 +171,8 @@ def cleanup(self): # the add_link function creates a link and assigns the interface names # as node1-node2 and node2-node1 def add_link(my_net, node1, node2): - my_net.addLink(node1, node2, intfName1=node1.name+'-'+node2.name, - intfName2=node2.name+'-'+node1.name) + my_net.addLink(node1, node2, intfName1=node1.name + '-' + node2.name, + intfName2=node2.name + '-' + node1.name) def create_topo(my_net): @@ -311,8 +311,8 @@ def stop_all(): def extract_host_pid(dumpline): - temp = dumpline[dumpline.find('pid=')+4:] - return int(temp[:len(temp)-2]) + temp = dumpline[dumpline.find('pid=') + 4:] + return int(temp[:len(temp) - 2]) def simple_test(): diff --git a/nets-unmantained/3routers/ospf3r.py b/nets-unmantained/3routers/ospf3r.py index 1365135..339c365 100644 --- a/nets-unmantained/3routers/ospf3r.py +++ b/nets-unmantained/3routers/ospf3r.py @@ -16,7 +16,7 @@ from mininet.util import dumpNodeConnections # BASEDIR = "/home/user/mytests/ospf3routers/nodeconf/" -BASEDIR = os.getcwd()+"/nodeconf/" +BASEDIR = os.getcwd() + "/nodeconf/" OUTPUT_PID_TABLE_FILE = "/tmp/pid_table_file.txt" PRIVDIR = '/var/priv' @@ -47,9 +47,9 @@ def config(self, **kwargs): # first = False # self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name)) # let's write the hostname in /var/mininet/hostname - self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname") - if os.path.isfile(BASEDIR+self.name+"/start.sh"): - self.cmd('source %s' % BASEDIR+self.name+"/start.sh") + self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname") + if os.path.isfile(BASEDIR + self.name + "/start.sh"): + self.cmd('source %s' % BASEDIR + self.name + "/start.sh") def cleanup(self): def remove_if_exists(filename): @@ -61,11 +61,11 @@ def remove_if_exists(filename): if os.path.exists(self.dir): shutil.rmtree(self.dir) - remove_if_exists(BASEDIR+self.name+"/zebra.pid") - remove_if_exists(BASEDIR+self.name+"/zebra.log") - remove_if_exists(BASEDIR+self.name+"/zebra.sock") - remove_if_exists(BASEDIR+self.name+"/ospfd.pid") - remove_if_exists(BASEDIR+self.name+"/ospfd.log") + remove_if_exists(BASEDIR + self.name + "/zebra.pid") + remove_if_exists(BASEDIR + self.name + "/zebra.log") + remove_if_exists(BASEDIR + self.name + "/zebra.sock") + remove_if_exists(BASEDIR + self.name + "/ospfd.pid") + remove_if_exists(BASEDIR + self.name + "/ospfd.log") remove_if_exists(OUTPUT_PID_TABLE_FILE) # if os.path.exists(BASEDIR+self.name+"/zebra.pid"): @@ -96,8 +96,8 @@ def __init__(self, name, *args, **kwargs): def add_link(node1, node2): - Link(node1, node2, intfName1=node1.name+'-'+node2.name, - intfName2=node2.name+'-'+node1.name) + Link(node1, node2, intfName1=node1.name + '-' + node2.name, + intfName2=node2.name + '-' + node1.name) def create_topo(my_net): @@ -137,8 +137,8 @@ def stop_all(): def extract_host_pid(dumpline): - temp = dumpline[dumpline.find('pid=')+4:] - return int(temp[:len(temp)-2]) + temp = dumpline[dumpline.find('pid=') + 4:] + return int(temp[:len(temp) - 2]) def simple_test(): diff --git a/nets-unmantained/8r-1c-out-band-isis/isis8d.py b/nets-unmantained/8r-1c-out-band-isis/isis8d.py index 337c5b3..e84b24f 100644 --- a/nets-unmantained/8r-1c-out-band-isis/isis8d.py +++ b/nets-unmantained/8r-1c-out-band-isis/isis8d.py @@ -20,7 +20,7 @@ from mininet.util import dumpNodeConnections # BASEDIR = "/home/user/mytests/ospf3routers/nodeconf/" -BASEDIR = os.getcwd()+"/nodeconf/" +BASEDIR = os.getcwd() + "/nodeconf/" OUTPUT_PID_TABLE_FILE = "/tmp/pid_table_file.txt" PRIVDIR = '/var/priv' @@ -72,9 +72,9 @@ def config(self, **kwargs): # first = False # self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name)) # let's write the hostname in /var/mininet/hostname - self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname") - if os.path.isfile(BASEDIR+self.name+"/start.sh"): - self.cmd('source %s' % BASEDIR+self.name+"/start.sh") + self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname") + if os.path.isfile(BASEDIR + self.name + "/start.sh"): + self.cmd('source %s' % BASEDIR + self.name + "/start.sh") def cleanup(self): def remove_if_exists(filename): @@ -86,13 +86,13 @@ def remove_if_exists(filename): if os.path.exists(self.dir): shutil.rmtree(self.dir) - remove_if_exists(BASEDIR+self.name+"/zebra.pid") - remove_if_exists(BASEDIR+self.name+"/zebra.log") - remove_if_exists(BASEDIR+self.name+"/zebra.sock") - remove_if_exists(BASEDIR+self.name+"/isis8d.pid") - remove_if_exists(BASEDIR+self.name+"/isis8d.log") - remove_if_exists(BASEDIR+self.name+"/isisd.log") - remove_if_exists(BASEDIR+self.name+"/isisd.pid") + remove_if_exists(BASEDIR + self.name + "/zebra.pid") + remove_if_exists(BASEDIR + self.name + "/zebra.log") + remove_if_exists(BASEDIR + self.name + "/zebra.sock") + remove_if_exists(BASEDIR + self.name + "/isis8d.pid") + remove_if_exists(BASEDIR + self.name + "/isis8d.log") + remove_if_exists(BASEDIR + self.name + "/isisd.log") + remove_if_exists(BASEDIR + self.name + "/isisd.pid") remove_if_exists(OUTPUT_PID_TABLE_FILE) @@ -152,9 +152,9 @@ def config(self, **kwargs): # first = False # self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name)) # let's write the hostname in /var/mininet/hostname - self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname") - if os.path.isfile(BASEDIR+self.name+"/start.sh"): - self.cmd('source %s' % BASEDIR+self.name+"/start.sh") + self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname") + if os.path.isfile(BASEDIR + self.name + "/start.sh"): + self.cmd('source %s' % BASEDIR + self.name + "/start.sh") def cleanup(self): # def remove_if_exists(filename): @@ -170,8 +170,8 @@ def cleanup(self): # the add_link function creates a link and assigns the interface names # as node1-node2 and node2-node1 def add_link(my_net, node1, node2): - my_net.addLink(node1, node2, intfName1=node1.name+'-'+node2.name, - intfName2=node2.name+'-'+node1.name) + my_net.addLink(node1, node2, intfName1=node1.name + '-' + node2.name, + intfName2=node2.name + '-' + node1.name) def create_topo(my_net): @@ -310,8 +310,8 @@ def stop_all(): def extract_host_pid(dumpline): - temp = dumpline[dumpline.find('pid=')+4:] - return int(temp[:len(temp)-2]) + temp = dumpline[dumpline.find('pid=') + 4:] + return int(temp[:len(temp) - 2]) def simple_test(): diff --git a/nets-unmantained/8routers/ospf8r.py b/nets-unmantained/8routers/ospf8r.py index 9d36b00..37b28eb 100644 --- a/nets-unmantained/8routers/ospf8r.py +++ b/nets-unmantained/8routers/ospf8r.py @@ -18,7 +18,7 @@ from mininet.util import dumpNodeConnections # BASEDIR = "/home/user/mytests/ospf3routers/nodeconf/" -BASEDIR = os.getcwd()+"/nodeconf/" +BASEDIR = os.getcwd() + "/nodeconf/" OUTPUT_PID_TABLE_FILE = "/tmp/pid_table_file.txt" PRIVDIR = '/var/priv' @@ -56,9 +56,9 @@ def config(self, **kwargs): # first = False # self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name)) # let's write the hostname in /var/mininet/hostname - self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname") - if os.path.isfile(BASEDIR+self.name+"/start.sh"): - self.cmd('source %s' % BASEDIR+self.name+"/start.sh") + self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname") + if os.path.isfile(BASEDIR + self.name + "/start.sh"): + self.cmd('source %s' % BASEDIR + self.name + "/start.sh") def cleanup(self): def remove_if_exists(filename): @@ -70,13 +70,13 @@ def remove_if_exists(filename): if os.path.exists(self.dir): shutil.rmtree(self.dir) - remove_if_exists(BASEDIR+self.name+"/zebra.pid") - remove_if_exists(BASEDIR+self.name+"/zebra.log") - remove_if_exists(BASEDIR+self.name+"/zebra.sock") - remove_if_exists(BASEDIR+self.name+"/ospf6d.pid") - remove_if_exists(BASEDIR+self.name+"/ospf6d.log") - remove_if_exists(BASEDIR+self.name+"/ospfd.log") - remove_if_exists(BASEDIR+self.name+"/ospfd.pid") + remove_if_exists(BASEDIR + self.name + "/zebra.pid") + remove_if_exists(BASEDIR + self.name + "/zebra.log") + remove_if_exists(BASEDIR + self.name + "/zebra.sock") + remove_if_exists(BASEDIR + self.name + "/ospf6d.pid") + remove_if_exists(BASEDIR + self.name + "/ospf6d.log") + remove_if_exists(BASEDIR + self.name + "/ospfd.log") + remove_if_exists(BASEDIR + self.name + "/ospfd.pid") remove_if_exists(OUTPUT_PID_TABLE_FILE) @@ -108,8 +108,8 @@ def __init__(self, name, *args, **kwargs): def add_link(my_net, node1, node2): - my_net.addLink(node1, node2, intfName1=node1.name+'-'+node2.name, - intfName2=node2.name+'-'+node1.name) + my_net.addLink(node1, node2, intfName1=node1.name + '-' + node2.name, + intfName2=node2.name + '-' + node1.name) def create_topo(my_net): @@ -226,8 +226,8 @@ def stop_all(): def extract_host_pid(dumpline): - temp = dumpline[dumpline.find('pid=')+4:] - return int(temp[:len(temp)-2]) + temp = dumpline[dumpline.find('pid=') + 4:] + return int(temp[:len(temp) - 2]) def simple_test(): diff --git a/nets/8r-1c-in-band-isis/isis8d.py b/nets/8r-1c-in-band-isis/isis8d.py index bab25a3..fc2ec90 100644 --- a/nets/8r-1c-in-band-isis/isis8d.py +++ b/nets/8r-1c-in-band-isis/isis8d.py @@ -20,7 +20,7 @@ from mininet.util import dumpNodeConnections # BASEDIR = "/home/user/mytests/ospf3routers/nodeconf/" -BASEDIR = os.getcwd()+"/nodeconf/" +BASEDIR = os.getcwd() + "/nodeconf/" OUTPUT_PID_TABLE_FILE = "/tmp/pid_table_file.txt" PRIVDIR = '/var/priv' @@ -72,9 +72,9 @@ def config(self, **kwargs): # first = False # self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name)) # let's write the hostname in /var/mininet/hostname - self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname") - if os.path.isfile(BASEDIR+self.name+"/start.sh"): - self.cmd('source %s' % BASEDIR+self.name+"/start.sh") + self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname") + if os.path.isfile(BASEDIR + self.name + "/start.sh"): + self.cmd('source %s' % BASEDIR + self.name + "/start.sh") def cleanup(self): def remove_if_exists(filename): @@ -86,13 +86,13 @@ def remove_if_exists(filename): if os.path.exists(self.dir): shutil.rmtree(self.dir) - remove_if_exists(BASEDIR+self.name+"/zebra.pid") - remove_if_exists(BASEDIR+self.name+"/zebra.log") - remove_if_exists(BASEDIR+self.name+"/zebra.sock") - remove_if_exists(BASEDIR+self.name+"/isis8d.pid") - remove_if_exists(BASEDIR+self.name+"/isis8d.log") - remove_if_exists(BASEDIR+self.name+"/isisd.log") - remove_if_exists(BASEDIR+self.name+"/isisd.pid") + remove_if_exists(BASEDIR + self.name + "/zebra.pid") + remove_if_exists(BASEDIR + self.name + "/zebra.log") + remove_if_exists(BASEDIR + self.name + "/zebra.sock") + remove_if_exists(BASEDIR + self.name + "/isis8d.pid") + remove_if_exists(BASEDIR + self.name + "/isis8d.log") + remove_if_exists(BASEDIR + self.name + "/isisd.log") + remove_if_exists(BASEDIR + self.name + "/isisd.pid") remove_if_exists(OUTPUT_PID_TABLE_FILE) @@ -131,8 +131,8 @@ def config(self, **kwargs): # the add_link function creates a link and assigns the interface names # as node1-node2 and node2-node1 def add_link(my_net, node1, node2): - my_net.addLink(node1, node2, intfName1=node1.name+'-'+node2.name, - intfName2=node2.name+'-'+node1.name) + my_net.addLink(node1, node2, intfName1=node1.name + '-' + node2.name, + intfName2=node2.name + '-' + node1.name) def create_topo(my_net): @@ -254,8 +254,8 @@ def stop_all(): def extract_host_pid(dumpline): - temp = dumpline[dumpline.find('pid=')+4:] - return int(temp[:len(temp)-2]) + temp = dumpline[dumpline.find('pid=') + 4:] + return int(temp[:len(temp) - 2]) def simple_test(): diff --git a/nets/8routers-isis-ipv6/isis8d.py b/nets/8routers-isis-ipv6/isis8d.py index 293b9ca..cfd1586 100644 --- a/nets/8routers-isis-ipv6/isis8d.py +++ b/nets/8routers-isis-ipv6/isis8d.py @@ -18,7 +18,7 @@ from mininet.util import dumpNodeConnections # BASEDIR = "/home/user/mytests/ospf3routers/nodeconf/" -BASEDIR = os.getcwd()+"/nodeconf/" +BASEDIR = os.getcwd() + "/nodeconf/" OUTPUT_PID_TABLE_FILE = "/tmp/pid_table_file.txt" PRIVDIR = '/var/priv' @@ -56,9 +56,9 @@ def config(self, **kwargs): # first = False # self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name)) # let's write the hostname in /var/mininet/hostname - self.cmd("echo '" + self.name + "' > "+PRIVDIR+"/hostname") - if os.path.isfile(BASEDIR+self.name+"/start.sh"): - self.cmd('source %s' % BASEDIR+self.name+"/start.sh") + self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname") + if os.path.isfile(BASEDIR + self.name + "/start.sh"): + self.cmd('source %s' % BASEDIR + self.name + "/start.sh") def cleanup(self): def remove_if_exists(filename): @@ -70,13 +70,13 @@ def remove_if_exists(filename): if os.path.exists(self.dir): shutil.rmtree(self.dir) - remove_if_exists(BASEDIR+self.name+"/zebra.pid") - remove_if_exists(BASEDIR+self.name+"/zebra.log") - remove_if_exists(BASEDIR+self.name+"/zebra.sock") - remove_if_exists(BASEDIR+self.name+"/isis8d.pid") - remove_if_exists(BASEDIR+self.name+"/isis8d.log") - remove_if_exists(BASEDIR+self.name+"/isisd.log") - remove_if_exists(BASEDIR+self.name+"/isisd.pid") + remove_if_exists(BASEDIR + self.name + "/zebra.pid") + remove_if_exists(BASEDIR + self.name + "/zebra.log") + remove_if_exists(BASEDIR + self.name + "/zebra.sock") + remove_if_exists(BASEDIR + self.name + "/isis8d.pid") + remove_if_exists(BASEDIR + self.name + "/isis8d.log") + remove_if_exists(BASEDIR + self.name + "/isisd.log") + remove_if_exists(BASEDIR + self.name + "/isisd.pid") remove_if_exists(OUTPUT_PID_TABLE_FILE) @@ -108,8 +108,8 @@ def __init__(self, name, *args, **kwargs): def add_link(my_net, node1, node2): - my_net.addLink(node1, node2, intfName1=node1.name+'-'+node2.name, - intfName2=node2.name+'-'+node1.name) + my_net.addLink(node1, node2, intfName1=node1.name + '-' + node2.name, + intfName2=node2.name + '-' + node1.name) def create_topo(my_net): @@ -226,8 +226,8 @@ def stop_all(): def extract_host_pid(dumpline): - temp = dumpline[dumpline.find('pid=')+4:] - return int(temp[:len(temp)-2]) + temp = dumpline[dumpline.find('pid=') + 4:] + return int(temp[:len(temp) - 2]) def simple_test():