From d17c3bfbfca2be2b7459bf08980a047147c96fed Mon Sep 17 00:00:00 2001 From: "S. John Banner" Date: Wed, 1 Mar 2017 22:57:59 +0100 Subject: [PATCH 1/3] Fix acilint to only print subjects with missing filters. * Was setting flag when a missing filter was found, but not resetting it, so all following subjects for that contract were marked as missing filters too. --- applications/lint/acilint.py | 1 + 1 file changed, 1 insertion(+) diff --git a/applications/lint/acilint.py b/applications/lint/acilint.py index 04fa5c80..470ccf25 100755 --- a/applications/lint/acilint.py +++ b/applications/lint/acilint.py @@ -393,6 +393,7 @@ def warning_014(self): self.output_handler("Warning 014: In tenant '%s' contract " "'%s' subject '%s' has no Filters." % ( tenant.name, contract.name, subject.name)) + missing_filter = False def error_001(self): """ From 9f17e2596c45b32d0ad1c06718c1654b738b3ff7 Mon Sep 17 00:00:00 2001 From: "S. John Banner" Date: Thu, 2 Mar 2017 13:32:35 +0100 Subject: [PATCH 2/3] Fix Warning 10 to find contracts provided in Common or ExternalEPGs * Add code to find contracts provided by ExternalEPGs and add them to the provider list. * Add code to look for providers in 'common' if they don't exist in the current tenant. --- applications/lint/acilint.py | 41 +++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/applications/lint/acilint.py b/applications/lint/acilint.py index 470ccf25..029742f7 100755 --- a/applications/lint/acilint.py +++ b/applications/lint/acilint.py @@ -217,6 +217,7 @@ def warning_010(self): """ provide_db = {} for tenant in self.tenants: + # TODO: Need code to deal with imported contracts. for app in tenant.get_children(AppProfile): for epg in app.get_children(EPG): if epg.has_bd(): @@ -231,6 +232,16 @@ def warning_010(self): provide_db[tenant.name][contract.name] = [] if context.name not in provide_db[tenant.name][contract.name]: provide_db[tenant.name][contract.name].append(context.name) + for l3out in tenant.get_children(OutsideL3): + for epg in l3out.get_children(OutsideEPG): + provided = epg.get_all_provided() + for contract in provided: + if tenant.name not in provide_db: + provide_db[tenant.name] = {} + if contract.name not in provide_db[tenant.name]: + provide_db[tenant.name][contract.name] = [] + if context.name not in provide_db[tenant.name][contract.name]: + provide_db[tenant.name][contract.name].append(context.name) for tenant in self.tenants: if tenant.name not in provide_db: @@ -248,14 +259,34 @@ def warning_010(self): context = bd.get_context() consumed = epg.get_all_consumed() for contract in consumed: - if contract.name not in provide_db[tenant.name]: + if contract.name in provide_db[tenant.name]: + if context.name not in provide_db[tenant.name][contract.name]: + self.output_handler("Warning 010: Contract '%s' not provided in context '%s' " + "where it is being consumed for" + " tenant '%s'" % (contract.name, context.name, tenant.name)) + elif (tenant.name != 'common') and (contract.name in provide_db['common']): + if context.name not in provide_db['common'][contract.name]: + self.output_handler("Warning 010: Contract '%s' not provided in context '%s' " + "where it is being consumed for" + " tenant '%s'" % (contract.name, context.name, tenant.name)) + elif tenant.name == 'common': self.output_handler("Warning 010: Contract '%s' not provided " "within the same tenant " "'%s'" % (contract.name, tenant.name)) - elif context.name not in provide_db[tenant.name][contract.name]: - self.output_handler("Warning 010: Contract '%s' not provided in context '%s' " - "where it is being consumed for" - " tenant '%s'" % (contract.name, context.name, tenant.name)) + else: + self.output_handler("Warning 010: Contract '%s' not provided " + "within the same tenant " + "'%s' or 'common'" % (contract.name, tenant.name)) + #if contract.name not in provide_db[tenant.name].keys() + provide_db['common'].keys(): + # self.output_handler("Warning 010: Contract '%s' not provided " + # "within the same tenant " + # "'%s'" % (contract.name, tenant.name)) + ##elif context.name not in provide_db[tenant.name][contract.name] + provide_db['common'][contract.name]: + #elif (contract.name in provide_db[tenant.name] and context.name not in provide_db[tenant.name][contract.name]) \ + # or (contract.name in provide_db['common'] and context.name not in provide_db['common'][contract.name]): + # self.output_handler("Warning 010: Contract '%s' not provided in context '%s' " + # "where it is being consumed for" + # " tenant '%s'" % (contract.name, context.name, tenant.name)) @staticmethod def subj_matches_proto(filterlist, protocol): From 36325d6ac9342a4bb92fd49c0d2aa2b8c53bbb3e Mon Sep 17 00:00:00 2001 From: "S. John Banner" Date: Thu, 31 Aug 2017 14:29:49 +0200 Subject: [PATCH 3/3] Don't start relogin thread if login fails. --- acitoolkit/acisession.py | 1 + 1 file changed, 1 insertion(+) diff --git a/acitoolkit/acisession.py b/acitoolkit/acisession.py index f9d98c97..949b6ff6 100755 --- a/acitoolkit/acisession.py +++ b/acitoolkit/acisession.py @@ -659,6 +659,7 @@ def login(self, timeout=None): resp = requests.Response() resp.status_code = 404 resp._content = '{"error": "Could not relogin to APIC due to ConnectionError"}' + return resp if (self.appcenter_user and self._subscription_enabled) or not self.cert_auth: self.login_thread.daemon = True self.login_thread.start()