This commit is contained in:
Ian Southam 2014-11-24 17:21:22 +01:00 committed by wilderrodrigues
parent 0496ba7a00
commit 08d2e10cb9
2 changed files with 8 additions and 8 deletions

View File

@ -103,10 +103,10 @@ class CsAcl(CsDataBag):
rnge = ''
if "first_port" in self.rule.keys() and \
self.rule['first_port'] == self.rule['last_port']:
rnge = self.rule['first_port']
rnge = self.rule['first_port']
if "first_port" in self.rule.keys() and \
self.rule['first_port'] != self.rule['last_port']:
rnge = "%s:%s" % (rule['first_port'], rule['last_port'])
rnge = "%s:%s" % (rule['first_port'], rule['last_port'])
if self.direction == 'ingress':
if rule['protocol'] == "icmp":
self.fw.append(["mangle", "front",
@ -136,7 +136,7 @@ class CsAcl(CsDataBag):
if rule['protocol'] != "all":
fwr += "-p %s " % rule['protocol'] + \
" -m %s " % rule['protocol'] + \
" --dport %s" % rnge
" --dport %s" % rnge
self.fw.append(["filter", "front", "%s -j %s" % (fwr, rule['action'])])
class AclDevice():
@ -172,7 +172,6 @@ class CsAcl(CsDataBag):
else:
self.init_vr(self, direction, acl, rule, config)
def init_vpc(self, direction, acl, rule, config):
self.table = ""
self.device = acl.device

View File

@ -18,14 +18,15 @@
from pprint import pprint
import copy
def merge(dbag, data):
dbagc = copy.deepcopy(dbag)
dbagc = copy.deepcopy(dbag)
if "rules" not in data:
return dbagc
for rule in data['rules']:
id = str(rule['id'])
id = str(rule['id'])
if rule['revoked']:
del(dbagc[id])
del(dbagc[id])
if id not in dbagc.keys():
dbagc[id] = rule
dbagc[id] = rule
return dbagc