Skip to content

Commit

Permalink
Removing unused import iptc
Browse files Browse the repository at this point in the history
  • Loading branch information
jeeva-duplo committed Nov 26, 2024
1 parent 3297cdd commit 1406973
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions AgentAmazonLinux2/NetworkAgentV2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import json
import argparse
import logging
import iptc
import sys
import traceback
import os
Expand Down Expand Up @@ -147,45 +146,6 @@ def updateTunnels(aInRemoteMinions, aInLocalMinion):

return

def addNetfilter(aInChain, aInRule, aInBlock):
rule = iptc.Rule()
match = rule.create_match("comment")
match.comment = aInRule['Name']

rule.dst = aInRule['DestAddress']

if aInRule['SrcAddress']:
rule.src = aInRule['SrcAddress']
if aInRule['Protocol']:
rule.protocol = aInRule['Protocol']
if aInRule['BeginPort']:
match = iptc.Match(rule, aInRule['Protocol'])
match.dport = aInRule['BeginPort'] + ":" + aInRule['EndPort']
rule.add_match(match)

if aInBlock:
rule.target = rule.create_target("DROP")
aInChain.append_rule(rule)
else:
rule.target = rule.create_target("ACCEPT")
aInChain.insert_rule(rule)

def deleteNetfilter(aInRuleName):
table = iptc.Table(iptc.Table.FILTER)

for chain in table.chains:
if not str(chain.name) == 'FORWARD':
continue
for rule in chain.rules:
for match in rule.matches:
if str(match.name) == 'comment':
lRName = str(match.comment)
if lRName == aInRuleName:
logger.debug('DELETING RULE: ' + lRName)
chain.delete_rule(rule)
break
break

def updateTopology():
global TenantID
global NetworkProvider
Expand Down Expand Up @@ -487,9 +447,6 @@ def updateImagesThread():
logger.debug('=============================================== UpdateImages Completed')





def setLogger():
logFile = "/var/log/NetworkAgent.log"
logger = logging.getLogger('NetworkAgent')
Expand All @@ -509,8 +466,6 @@ def setLogger():

return logger



def daemonizeUbuntu():
process_id = os.getpid()
logger.debug('Process ID after setid(): %s...' % str(process_id))
Expand Down

0 comments on commit 1406973

Please sign in to comment.