aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doxygen/siphon/process.py1
-rw-r--r--extras/vpp_config/vpplib/AutoConfig.py2
-rw-r--r--extras/vpp_config/vpplib/VppGrubUtil.py114
-rwxr-xr-xsrc/plugins/srv6-mobile/extra/runner.py2
-rw-r--r--src/plugins/vrrp/test/test_vrrp.py9
-rwxr-xr-xsrc/tools/vppapigen/vppapigen.py2
-rw-r--r--test/template_ipsec.py2
-rw-r--r--test/test_ip6.py1
-rwxr-xr-xtest/vpp_pg_interface.py3
9 files changed, 71 insertions, 65 deletions
diff --git a/doxygen/siphon/process.py b/doxygen/siphon/process.py
index 57e323e48ac..ce70be5b399 100644
--- a/doxygen/siphon/process.py
+++ b/doxygen/siphon/process.py
@@ -82,6 +82,7 @@ class Siphon(object):
self._tplenv = jinja2.Environment(
loader=loader,
trim_blocks=True,
+ autoescape=True,
keep_trailing_newline=True)
# Convenience, get a reference to the internal escape and
diff --git a/extras/vpp_config/vpplib/AutoConfig.py b/extras/vpp_config/vpplib/AutoConfig.py
index c4777104c0b..8c052a02773 100644
--- a/extras/vpp_config/vpplib/AutoConfig.py
+++ b/extras/vpp_config/vpplib/AutoConfig.py
@@ -122,7 +122,7 @@ class AutoConfig(object):
answer = input("Please enter the netmask [n.n.n.n]: ")
plen = ip_address(answer).netmask_bits()
return '{}/{}'.format(ipaddr, plen)
- except None:
+ except ValueError:
print("Please enter a valid IPv4 address.")
@staticmethod
diff --git a/extras/vpp_config/vpplib/VppGrubUtil.py b/extras/vpp_config/vpplib/VppGrubUtil.py
index d199f1eb053..f17efd8a868 100644
--- a/extras/vpp_config/vpplib/VppGrubUtil.py
+++ b/extras/vpp_config/vpplib/VppGrubUtil.py
@@ -164,63 +164,63 @@ class VppGrubUtil(object):
"""
vpp_cmdline = self.create_cmdline(isolated_cpus)
- if vpp_cmdline == '':
- return vpp_cmdline
-
- # Update grub
- # Save the original file
- rootdir = node['rootdir']
- grubcmdline = node['cpu']['grubcmdline']
- ofilename = rootdir + node['cpu']['grub_config_file'] + '.orig'
- filename = rootdir + node['cpu']['grub_config_file']
-
- # Write the output file
- # Does a copy of the original file exist, if not create one
- (ret, stdout, stderr) = VPPUtil.exec_command('ls {}'.format(ofilename))
- if ret != 0:
- if stdout.strip('\n') != ofilename:
- cmd = 'sudo cp {} {}'.format(filename, ofilename)
- (ret, stdout, stderr) = VPPUtil.exec_command(cmd)
- if ret != 0:
- raise RuntimeError('{} failed on node {} {}'.
- format(cmd, self._node['host'], stderr))
-
- # Get the contents of the current grub config file
- cmd = 'cat {}'.format(filename)
- (ret, stdout, stderr) = VPPUtil.exec_command(cmd)
- if ret != 0:
- raise RuntimeError('{} failed on node {} {}'.format(
- cmd,
- self._node['host'],
- stderr))
-
- # Write the new contents
- # Get the Default Linux command line, ignoring commented lines
- content = ""
- lines = stdout.split('\n')
- for line in lines:
- if line == '':
- content += line + '\n'
- continue
- if line[0] == '#':
- content += line + '\n'
- continue
-
- ldefault = re.findall(r'{}=.+'.format(grubcmdline), line)
- if ldefault:
- content += vpp_cmdline + '\n'
- else:
- content += line + '\n'
-
- content = content.replace(r"`", r"\`")
- content = content.rstrip('\n')
- cmd = "sudo cat > {0} << EOF\n{1}\n".format(filename, content)
- (ret, stdout, stderr) = VPPUtil.exec_command(cmd)
- if ret != 0:
- raise RuntimeError('{} failed on node {} {}'.format(
- cmd,
- self._node['host'],
- stderr))
+ if len(vpp_cmdline):
+ # Update grub
+ # Save the original file
+ rootdir = node['rootdir']
+ grubcmdline = node['cpu']['grubcmdline']
+ ofilename = rootdir + node['cpu']['grub_config_file'] + '.orig'
+ filename = rootdir + node['cpu']['grub_config_file']
+
+ # Write the output file
+ # Does a copy of the original file exist, if not create one
+ (ret, stdout, stderr) = VPPUtil.exec_command(
+ 'ls {}'.format(ofilename))
+ if ret != 0:
+ if stdout.strip('\n') != ofilename:
+ cmd = 'sudo cp {} {}'.format(filename, ofilename)
+ (ret, stdout, stderr) = VPPUtil.exec_command(cmd)
+ if ret != 0:
+ raise RuntimeError('{} failed on node {} {}'.
+ format(cmd, self._node['host'],
+ stderr))
+
+ # Get the contents of the current grub config file
+ cmd = 'cat {}'.format(filename)
+ (ret, stdout, stderr) = VPPUtil.exec_command(cmd)
+ if ret != 0:
+ raise RuntimeError('{} failed on node {} {}'.format(
+ cmd,
+ self._node['host'],
+ stderr))
+
+ # Write the new contents
+ # Get the Default Linux command line, ignoring commented lines
+ content = ""
+ lines = stdout.split('\n')
+ for line in lines:
+ if line == '':
+ content += line + '\n'
+ continue
+ if line[0] == '#':
+ content += line + '\n'
+ continue
+
+ ldefault = re.findall(r'{}=.+'.format(grubcmdline), line)
+ if ldefault:
+ content += vpp_cmdline + '\n'
+ else:
+ content += line + '\n'
+
+ content = content.replace(r"`", r"\`")
+ content = content.rstrip('\n')
+ cmd = "sudo cat > {0} << EOF\n{1}\n".format(filename, content)
+ (ret, stdout, stderr) = VPPUtil.exec_command(cmd)
+ if ret != 0:
+ raise RuntimeError('{} failed on node {} {}'.format(
+ cmd,
+ self._node['host'],
+ stderr))
return vpp_cmdline
diff --git a/src/plugins/srv6-mobile/extra/runner.py b/src/plugins/srv6-mobile/extra/runner.py
index c438fb161b7..b18fdc32766 100755
--- a/src/plugins/srv6-mobile/extra/runner.py
+++ b/src/plugins/srv6-mobile/extra/runner.py
@@ -248,6 +248,7 @@ class Containers(object):
def build(self, path, vpp_path):
env = Environment(loader=FileSystemLoader(path),
+ autoescape=True,
trim_blocks=True)
self.tmp_render(join(vpp_path, "Dockerfile"),
@@ -264,6 +265,7 @@ class Containers(object):
def release(self, path, vpp_path):
env = Environment(loader=FileSystemLoader(path),
+ autoescape=True,
trim_blocks=True)
self.tmp_render(join(vpp_path, "Dockerfile"),
diff --git a/src/plugins/vrrp/test/test_vrrp.py b/src/plugins/vrrp/test/test_vrrp.py
index cd2aeb10ec3..3a85d2e6b66 100644
--- a/src/plugins/vrrp/test/test_vrrp.py
+++ b/src/plugins/vrrp/test/test_vrrp.py
@@ -8,12 +8,13 @@
import unittest
import time
-from socket import inet_pton, inet_ntop, AF_INET6
+import socket
+from socket import inet_pton, inet_ntop
from vpp_object import VppObject
from vpp_papi import VppEnum
-from scapy.packet import Raw
+from scapy.packet import raw
from scapy.layers.l2 import Ether, ARP
from scapy.layers.inet import IP, ICMP, icmptypes
from scapy.layers.inet6 import IPv6, ipv6nh, IPv6ExtHdrHopByHop, \
@@ -833,8 +834,8 @@ class TestVRRP6(VppTestCase):
self.assertEqual(pkt[IPv6].dst, "ff02::1")
# convert addrs to packed format since string versions could differ
- src_addr = inet_pton(AF_INET6, pkt[IPv6].src)
- vr_ll_addr = inet_pton(AF_INET6, vr.interface().local_ip6_ll)
+ src_addr = inet_pton(socket.AF_INET6, pkt[IPv6].src)
+ vr_ll_addr = inet_pton(socket.AF_INET6, vr.interface().local_ip6_ll)
self.assertEqual(src_addr, vr_ll_addr)
self.assertTrue(pkt[ICMPv6ND_NA].tgt in vr.virtual_ips())
diff --git a/src/tools/vppapigen/vppapigen.py b/src/tools/vppapigen/vppapigen.py
index f3013aa6021..b17ad6d15c9 100755
--- a/src/tools/vppapigen/vppapigen.py
+++ b/src/tools/vppapigen/vppapigen.py
@@ -648,7 +648,7 @@ class VPPAPIParser(object):
elif len(p) == 4:
p[0] = Field(p[1], p[2])
else:
- self._parse_error('ERROR')
+ self._parse_error('ERROR', self._token_coord(p, 1))
self.fields.append(p[2])
def p_declaration_array_vla(self, p):
diff --git a/test/template_ipsec.py b/test/template_ipsec.py
index 5a700e89f6f..1caed0dd932 100644
--- a/test/template_ipsec.py
+++ b/test/template_ipsec.py
@@ -5,7 +5,7 @@ import struct
from scapy.layers.inet import IP, ICMP, TCP, UDP
from scapy.layers.ipsec import SecurityAssociation, ESP
from scapy.layers.l2 import Ether
-from scapy.packet import Raw
+from scapy.packet import raw, Raw
from scapy.layers.inet6 import IPv6, ICMPv6EchoRequest, IPv6ExtHdrHopByHop, \
IPv6ExtHdrFragment, IPv6ExtHdrDestOpt
diff --git a/test/test_ip6.py b/test/test_ip6.py
index 1f00ed32a8c..63d3e41f915 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
+import socket
from socket import inet_pton, inet_ntop
import unittest
diff --git a/test/vpp_pg_interface.py b/test/vpp_pg_interface.py
index b7f1881d516..32c0eaef401 100755
--- a/test/vpp_pg_interface.py
+++ b/test/vpp_pg_interface.py
@@ -1,7 +1,8 @@
import os
-import time
+import socket
from socket import inet_pton, inet_ntop
import struct
+import time
from traceback import format_exc, format_stack
import scapy.compat