# Path: opennsa/topology/nrm.py
# LOG_SYSTEM = 'topology.nrm'
# PORT_TYPES      = [ cnt.ETHERNET ] # OpenNSA doesn't really do unidirectional at the moment
# PATH_ATTRIBUTES = [ 'vector' ]
# ATTRIBUTES      = [ cnt.RESTRICTTRANSIT ]
# LABEL_TYPES     = { 'vlan'  : cnt.ETHERNET_VLAN,
#                     'mpls'  : cnt.MPLS }
# PORT_RX = re.compile('([^#]+)#([^\(]+)(?:\((.+?)\|(.+?)\))?')
# class NRMSpecificationError(Exception):
# class NRMPort(object):
#     def __init__(self, port_type, name, remote_network, remote_port, remote_in, remote_out, label, bandwidth, interface, authz, vectors=None, transit_restricted=False):
# def _parseRemoteSpec(remote_spec):
# def _parseLabelSpec(label_spec):
# def parsePortSpec(source):


from io import StringIO
from twisted.trial import unittest
from opennsa.topology import nrm




NRM_ENTRY = \
"""
# some comment
ethernet     ps              -                              vlan:1780-1788  1000    em0     -
ethernet     eth             -                              -               1000    em0     -
ethernet     netherlight     netherlight#intf1(-in|-out)    vlan:1780-1783  1000    em1     -
ethernet     somelight       somelight#intf2(-in|-out)      vlan:1780-1780  1000    em8     -
ethernet     uvalight        uvalight#intf3(-in|-out)       vlan:1780-1783  1000    em2     -
ethernet     splight         splight#intf4(-in|-out)        mpls:1780-1783  1000    em7     -
ethernet     aruba           aruba.net#intf5(-in|-out)      mpls:1780-1783  1000    em8     -
ethernet     san             aruba.net:san#arb(-in|-out)    vlan:1780-1799  1000    em9     -
"""


class NRMParserTest(unittest.TestCase):

    def testPortMapping(self):


# Path: opennsa/topology/nrm.py
# LOG_SYSTEM = 'topology.nrm'
# PORT_TYPES      = [ cnt.ETHERNET ] # OpenNSA doesn't really do unidirectional at the moment
# PATH_ATTRIBUTES = [ 'vector' ]
# ATTRIBUTES      = [ cnt.RESTRICTTRANSIT ]
# LABEL_TYPES     = { 'vlan'  : cnt.ETHERNET_VLAN,
#                     'mpls'  : cnt.MPLS }
# PORT_RX = re.compile('([^#]+)#([^\(]+)(?:\((.+?)\|(.+?)\))?')
# class NRMSpecificationError(Exception):
# class NRMPort(object):
#     def __init__(self, port_type, name, remote_network, remote_port, remote_in, remote_out, label, bandwidth, interface, authz, vectors=None, transit_restricted=False):
# def _parseRemoteSpec(remote_spec):
# def _parseLabelSpec(label_spec):
# def parsePortSpec(source):


# Path: test/test_nrmparser.py
from io import StringIO
from twisted.trial import unittest
from opennsa.topology import nrm





NRM_ENTRY = \
"""
# some comment
ethernet     ps              -                              vlan:1780-1788  1000    em0     -
ethernet     eth             -                              -               1000    em0     -
ethernet     netherlight     netherlight#intf1(-in|-out)    vlan:1780-1783  1000    em1     -
ethernet     somelight       somelight#intf2(-in|-out)      vlan:1780-1780  1000    em8     -
ethernet     uvalight        uvalight#intf3(-in|-out)       vlan:1780-1783  1000    em2     -
ethernet     splight         splight#intf4(-in|-out)        mpls:1780-1783  1000    em7     -
ethernet     aruba           aruba.net#intf5(-in|-out)      mpls:1780-1783  1000    em8     -
ethernet     san             aruba.net:san#arb(-in|-out)    vlan:1780-1799  1000    em9     -
"""


class NRMParserTest(unittest.TestCase):

    def testPortMapping(self):


        nrm_ports = nrm.parsePortSpec( StringIO(NRM_ENTRY) )