This commit is contained in:
brent s. 2020-05-12 19:39:16 -04:00
parent bb4055c87f
commit 136b41cb0e
Signed by: bts
GPG Key ID: 8C004C2F93481F6B
1 changed files with 7 additions and 1 deletions

View File

@ -89,6 +89,7 @@ class Tunnel(object):
self.client = None self.client = None
self.server = None self.server = None
self.creds = None # This should be handled externally and map to a Cred obj self.creds = None # This should be handled externally and map to a Cred obj
self.creds_id = None
self.allocations = [] self.allocations = []
self.parse() self.parse()


@ -104,6 +105,10 @@ class Tunnel(object):
self.client = IP6(_ip_txt, _prefix_txt) self.client = IP6(_ip_txt, _prefix_txt)
return(None) return(None)


def _creds(self):
self.creds_id = self.xml.attrib['creds'].strip()
return(None)

def _id(self): def _id(self):
self.id = int(self.xml.attrib['id'].strip()) self.id = int(self.xml.attrib['id'].strip())
return(None) return(None)
@ -116,6 +121,7 @@ class Tunnel(object):


def parse(self): def parse(self):
self._id() self._id()
self._creds()
self._client() self._client()
self._server() self._server()
self._allocations() self._allocations()
@ -194,7 +200,7 @@ class Config(object):
tunnels_xml = self.xml.find('tunnels') tunnels_xml = self.xml.find('tunnels')
for tun_xml in tunnels_xml.findall('tunnel'): for tun_xml in tunnels_xml.findall('tunnel'):
tun = Tunnel(tun_xml) tun = Tunnel(tun_xml)
tun.creds = self.creds.get(tun.creds) tun.creds = self.creds.get(tun.creds_id)
self.tunnels[tun.id] = tun self.tunnels[tun.id] = tun
return(None) return(None)