# Path: opennsa/shared/xmlhelper.py
# class UTC(datetime.tzinfo):
#     def utcoffset(self, dt):
#     def dst(self, dt):
#     def tzname(self, dt):
# def createXMLTime(timestamp):
# def parseXMLTimestamp(xsd_timestamp):
# 
# Path: opennsa/shared/modifiableresource.py
# RFC850_FORMAT       = '%a, %d %b %Y %H:%M:%S GMT'
# CONTENT_TYPE        = 'Content-type'
# LAST_MODIFIED       = 'Last-modified'
# IF_MODIFIED_SINCE   = 'if-modified-since'
# class ModifiableResource(resource.Resource):
#     def __init__(self, log_system, mime_type=None):
#     def updateResource(self, representation, update_time=None):
#     def render_GET(self, request):


from xml.etree import ElementTree as ET
from opennsa.shared import xmlhelper, modifiableresource
from opennsa.discovery.bindings import discovery
                 link_vector=None):

        self.nsa_id                 = nsa_id                # string
        self.version                = version               # datetime
        self.name                   = name                  # string
        self.software_version       = software_version      # string
        self.start_time             = start_time            # datetime
        self.network_ids            = network_ids           # [ string ]
        self.interfaces             = interfaces            # [ (type, url, described_by) ]
        self.features               = features              # [ (type, value) ]
        self.provider_registry      = provider_registry     # provreg.ProviderRegistry
        self.link_vector            = link_vector           # linkvector.LinkVector


    def xml(self):

        # location not really supported yet
        interface_types = [ discovery.InterfaceType(i[0], i[1], i[2]) for i in self.interfaces ]
        feature_types   = [ discovery.FeatureType(f[0], f[1]) for f in self.features ]

        # if we have multiple networks, we get the provider urn multiple times
        peers_with = set(self.provider_registry.provider_urns.values())

        try:
            peers_with.remove(self.nsa_id)
        except ValueError:
            pass # running in aggregator-only mode

        nsa_element = discovery.NsaType(
            self.nsa_id,

# Path: opennsa/shared/xmlhelper.py
# class UTC(datetime.tzinfo):
#     def utcoffset(self, dt):
#     def dst(self, dt):
#     def tzname(self, dt):
# def createXMLTime(timestamp):
# def parseXMLTimestamp(xsd_timestamp):
# 
# Path: opennsa/shared/modifiableresource.py
# RFC850_FORMAT       = '%a, %d %b %Y %H:%M:%S GMT'
# CONTENT_TYPE        = 'Content-type'
# LAST_MODIFIED       = 'Last-modified'
# IF_MODIFIED_SINCE   = 'if-modified-since'
# class ModifiableResource(resource.Resource):
#     def __init__(self, log_system, mime_type=None):
#     def updateResource(self, representation, update_time=None):
#     def render_GET(self, request):


# Path: opennsa/discovery/service.py
from xml.etree import ElementTree as ET
from opennsa.shared import xmlhelper, modifiableresource
from opennsa.discovery.bindings import discovery

                 link_vector=None):

        self.nsa_id                 = nsa_id                # string
        self.version                = version               # datetime
        self.name                   = name                  # string
        self.software_version       = software_version      # string
        self.start_time             = start_time            # datetime
        self.network_ids            = network_ids           # [ string ]
        self.interfaces             = interfaces            # [ (type, url, described_by) ]
        self.features               = features              # [ (type, value) ]
        self.provider_registry      = provider_registry     # provreg.ProviderRegistry
        self.link_vector            = link_vector           # linkvector.LinkVector


    def xml(self):

        # location not really supported yet
        interface_types = [ discovery.InterfaceType(i[0], i[1], i[2]) for i in self.interfaces ]
        feature_types   = [ discovery.FeatureType(f[0], f[1]) for f in self.features ]

        # if we have multiple networks, we get the provider urn multiple times
        peers_with = set(self.provider_registry.provider_urns.values())

        try:
            peers_with.remove(self.nsa_id)
        except ValueError:
            pass # running in aggregator-only mode

        nsa_element = discovery.NsaType(
            self.nsa_id,

            xmlhelper.createXMLTime(self.version),