# Path: opennsa/constants.py
# URN_OGF_PREFIX      = 'urn:ogf:network:'
# CS2_SERVICE_TYPE    = 'application/vnd.org.ogf.nsi.cs.v2+soap'
# NML_SERVICE_TYPE    = 'application/vnd.ogf.nsi.topology.v2+xml'
# CS2_REQUESTER       = 'application/vnd.ogf.nsi.cs.v2.requester+soap'
# CS2_PROVIDER        = 'application/vnd.ogf.nsi.cs.v2.provider+soap'
# OPENNSA_REST        = 'application/vnd.net.nordu.opennsa+rest'
# BIDIRECTIONAL       = 'Bidirectional'
# EVTS_AGOLE          = 'http://services.ogf.org/nsi/2013/07/descriptions/EVTS.A-GOLE'
# ETHERNET            = 'ethernet' # bidirectional implied
# ETHERNET_VLAN       = 'vlan'
# MPLS                = 'mpls'
# RESTRICTTRANSIT     = 'restricttransit'
# ETHERNET_NS         = 'http://schemas.ogf.org/nml/2012/10/ethernet'
# NML_ETHERNET_VLAN   = '%s#vlan' % ETHERNET_NS
# NML_MPLS            = 'http://nsi.nordu.net/nml#mpls' # pretty much just made up
# FEATURE_AGGREGATOR  = 'vnd.ogf.nsi.cs.v2.role.aggregator'
# FEATURE_UPA         = 'vnd.ogf.nsi.cs.v2.role.uPA'
# REQUIRE_USER        = 'requireuser'
# REQUIRE_TRACE       = 'requiretrace'
# AGGREGATOR          = 'aggregator'
# ALLOW_HAIRPIN       = 'allowhairpin'


import os
import configparser
from opennsa import constants as cnt
        vc[REST] = cfg.getboolean(BLOCK_SERVICE, REST, fallback=False)

        try:
            peers_raw = cfg.get(BLOCK_SERVICE, PEERS)
            vc[PEERS] = [Peer(purl.strip(), 1) for purl in peers_raw.split('\n')]
        except configparser.NoOptionError:
            vc[PEERS] = None

        vc[HOST] = cfg.get(BLOCK_SERVICE, HOST, fallback=None)
        vc[TLS] = cfg.getboolean(BLOCK_SERVICE, TLS, fallback=DEFAULT_TLS)
        vc[PORT] = cfg.getint(BLOCK_SERVICE, PORT, fallback=DEFAULT_TLS_PORT if vc[TLS] else DEFAULT_TCP_PORT)

        try:
            vc[BASE_URL] = cfg.get(BLOCK_SERVICE, BASE_URL)
        except configparser.NoOptionError:
            vc[BASE_URL] = None

        try:
            vc[KEY] = cfg.get(BLOCK_SERVICE, KEY)
        except configparser.NoOptionError:
            vc[KEY] = None

        try:
            vc[CERTIFICATE] = cfg.get(BLOCK_SERVICE, CERTIFICATE)
        except configparser.NoOptionError:
            vc[CERTIFICATE] = None

        try:
            policies = cfg.get(BLOCK_SERVICE, POLICY).split(',')
            for policy in policies:

# Path: opennsa/constants.py
# URN_OGF_PREFIX      = 'urn:ogf:network:'
# CS2_SERVICE_TYPE    = 'application/vnd.org.ogf.nsi.cs.v2+soap'
# NML_SERVICE_TYPE    = 'application/vnd.ogf.nsi.topology.v2+xml'
# CS2_REQUESTER       = 'application/vnd.ogf.nsi.cs.v2.requester+soap'
# CS2_PROVIDER        = 'application/vnd.ogf.nsi.cs.v2.provider+soap'
# OPENNSA_REST        = 'application/vnd.net.nordu.opennsa+rest'
# BIDIRECTIONAL       = 'Bidirectional'
# EVTS_AGOLE          = 'http://services.ogf.org/nsi/2013/07/descriptions/EVTS.A-GOLE'
# ETHERNET            = 'ethernet' # bidirectional implied
# ETHERNET_VLAN       = 'vlan'
# MPLS                = 'mpls'
# RESTRICTTRANSIT     = 'restricttransit'
# ETHERNET_NS         = 'http://schemas.ogf.org/nml/2012/10/ethernet'
# NML_ETHERNET_VLAN   = '%s#vlan' % ETHERNET_NS
# NML_MPLS            = 'http://nsi.nordu.net/nml#mpls' # pretty much just made up
# FEATURE_AGGREGATOR  = 'vnd.ogf.nsi.cs.v2.role.aggregator'
# FEATURE_UPA         = 'vnd.ogf.nsi.cs.v2.role.uPA'
# REQUIRE_USER        = 'requireuser'
# REQUIRE_TRACE       = 'requiretrace'
# AGGREGATOR          = 'aggregator'
# ALLOW_HAIRPIN       = 'allowhairpin'


# Path: opennsa/config.py
import os
import configparser
from opennsa import constants as cnt

        vc[REST] = cfg.getboolean(BLOCK_SERVICE, REST, fallback=False)

        try:
            peers_raw = cfg.get(BLOCK_SERVICE, PEERS)
            vc[PEERS] = [Peer(purl.strip(), 1) for purl in peers_raw.split('\n')]
        except configparser.NoOptionError:
            vc[PEERS] = None

        vc[HOST] = cfg.get(BLOCK_SERVICE, HOST, fallback=None)
        vc[TLS] = cfg.getboolean(BLOCK_SERVICE, TLS, fallback=DEFAULT_TLS)
        vc[PORT] = cfg.getint(BLOCK_SERVICE, PORT, fallback=DEFAULT_TLS_PORT if vc[TLS] else DEFAULT_TCP_PORT)

        try:
            vc[BASE_URL] = cfg.get(BLOCK_SERVICE, BASE_URL)
        except configparser.NoOptionError:
            vc[BASE_URL] = None

        try:
            vc[KEY] = cfg.get(BLOCK_SERVICE, KEY)
        except configparser.NoOptionError:
            vc[KEY] = None

        try:
            vc[CERTIFICATE] = cfg.get(BLOCK_SERVICE, CERTIFICATE)
        except configparser.NoOptionError:
            vc[CERTIFICATE] = None

        try:
            policies = cfg.get(BLOCK_SERVICE, POLICY).split(',')
            for policy in policies:

                if not policy in (cnt.REQUIRE_USER, cnt.REQUIRE_TRACE, cnt.AGGREGATOR, cnt.ALLOW_HAIRPIN):