# 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/topology/nmlxml.py
# LOG_SYSTEM = 'topology.nmlxml'
# NML_NS = 'http://schemas.ogf.org/nml/2013/05/base#'
# NSI_DEF_NS = "http://schemas.ogf.org/nsi/2013/12/services/definition"
# ID = 'id'
# VERSION = 'version'
# TYPE = 'type'
# ENCODING = 'encoding'
# LABEL_TYPE = 'labeltype'
# LABEL_TYPE_CAMEL = 'labelType'
# LABEL_SWAPPING = 'labelSwapping'
# NML_TOPOLOGY            = ET.QName('{%s}Topology'   % NML_NS)
# NML_PORT                = ET.QName('{%s}Port'       % NML_NS)
# NML_PORTGROUP           = ET.QName('{%s}PortGroup'  % NML_NS)
# NML_LABEL               = ET.QName('{%s}Label'      % NML_NS)
# NML_LABELGROUP          = ET.QName('{%s}LabelGroup' % NML_NS)
# NML_NAME                = ET.QName('{%s}name'       % NML_NS)
# NML_RELATION            = ET.QName('{%s}Relation'   % NML_NS)
# NML_NODE                = ET.QName('{%s}Node'       % NML_NS)
# NML_BIDIRECTIONALPORT   = ET.QName('{%s}BidirectionalPort' % NML_NS)
# NML_SWITCHINGSERVICE    = ET.QName('{%s}SwitchingService'  % NML_NS)
# NML_HASINBOUNDPORT      = NML_NS + 'hasInboundPort'
# NML_HASOUTBOUNDPORT     = NML_NS + 'hasOutboundPort'
# NML_MANAGEDBY           = NML_NS + 'managedBy'
# NML_ISALIAS             = NML_NS + 'isAlias'
# NML_HASSERVICE          = NML_NS + 'hasService'
# NML_LABEL_MAPPING = {
#     cnt.ETHERNET_VLAN : cnt.NML_ETHERNET_VLAN,
#     cnt.MPLS          : cnt.NML_MPLS
# }
# NSI_SERVICE_DEFINITION = ET.QName('{%s}serviceDefinition' % NSI_DEF_NS)
#     BASE_URN = cnt.URN_OGF_PREFIX + network.id_
# def topologyXML(network, labelSwap=False):
#     def addPort(nml_port_relation, port):
# def _baseName(urn_id):
# def parseNMLPort(nml_port):
# def parseNMLTopology(nml_topology):


from xml.etree import ElementTree as ET
from opennsa.shared import modifiableresource
from opennsa.topology import nmlxml
"""
HTTP interface for retrieving a topology.

Currently this means an XML representation of an NML topology.

Author: Henrik Thostrup Jensen <htj@nordu.net>
Copyright: NORDUnet (2013)
"""




class NMLService(object):

    def __init__(self, nml_network, can_swap_label):

        self.nml_network = nml_network
        self.can_swap_label = can_swap_label
        self._resource = modifiableresource.ModifiableResource('NMLService', 'application/xml')
        self.update()


    def update(self):


# 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/topology/nmlxml.py
# LOG_SYSTEM = 'topology.nmlxml'
# NML_NS = 'http://schemas.ogf.org/nml/2013/05/base#'
# NSI_DEF_NS = "http://schemas.ogf.org/nsi/2013/12/services/definition"
# ID = 'id'
# VERSION = 'version'
# TYPE = 'type'
# ENCODING = 'encoding'
# LABEL_TYPE = 'labeltype'
# LABEL_TYPE_CAMEL = 'labelType'
# LABEL_SWAPPING = 'labelSwapping'
# NML_TOPOLOGY            = ET.QName('{%s}Topology'   % NML_NS)
# NML_PORT                = ET.QName('{%s}Port'       % NML_NS)
# NML_PORTGROUP           = ET.QName('{%s}PortGroup'  % NML_NS)
# NML_LABEL               = ET.QName('{%s}Label'      % NML_NS)
# NML_LABELGROUP          = ET.QName('{%s}LabelGroup' % NML_NS)
# NML_NAME                = ET.QName('{%s}name'       % NML_NS)
# NML_RELATION            = ET.QName('{%s}Relation'   % NML_NS)
# NML_NODE                = ET.QName('{%s}Node'       % NML_NS)
# NML_BIDIRECTIONALPORT   = ET.QName('{%s}BidirectionalPort' % NML_NS)
# NML_SWITCHINGSERVICE    = ET.QName('{%s}SwitchingService'  % NML_NS)
# NML_HASINBOUNDPORT      = NML_NS + 'hasInboundPort'
# NML_HASOUTBOUNDPORT     = NML_NS + 'hasOutboundPort'
# NML_MANAGEDBY           = NML_NS + 'managedBy'
# NML_ISALIAS             = NML_NS + 'isAlias'
# NML_HASSERVICE          = NML_NS + 'hasService'
# NML_LABEL_MAPPING = {
#     cnt.ETHERNET_VLAN : cnt.NML_ETHERNET_VLAN,
#     cnt.MPLS          : cnt.NML_MPLS
# }
# NSI_SERVICE_DEFINITION = ET.QName('{%s}serviceDefinition' % NSI_DEF_NS)
#     BASE_URN = cnt.URN_OGF_PREFIX + network.id_
# def topologyXML(network, labelSwap=False):
#     def addPort(nml_port_relation, port):
# def _baseName(urn_id):
# def parseNMLPort(nml_port):
# def parseNMLTopology(nml_topology):


# Path: opennsa/topology/service.py
from xml.etree import ElementTree as ET
from opennsa.shared import modifiableresource
from opennsa.topology import nmlxml

"""
HTTP interface for retrieving a topology.

Currently this means an XML representation of an NML topology.

Author: Henrik Thostrup Jensen <htj@nordu.net>
Copyright: NORDUnet (2013)
"""




class NMLService(object):

    def __init__(self, nml_network, can_swap_label):

        self.nml_network = nml_network
        self.can_swap_label = can_swap_label
        self._resource = modifiableresource.ModifiableResource('NMLService', 'application/xml')
        self.update()


    def update(self):


        xml_nml_topology = nmlxml.topologyXML(self.nml_network, self.can_swap_label)