Skip to content
Snippets Groups Projects
Commit 2d34bece authored by Pablo Armingol's avatar Pablo Armingol
Browse files

L3 unicast topology NBI

parent fb924d25
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!252Resolve "(TID) Add support to NBI to export the L3 inventory"
Showing
with 432 additions and 13922 deletions
# Copyright 2022-2024 ETSI OSG/SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from enum import Enum
from typing import Optional
class NetworkTypeEnum(Enum):
TE_OTN_TOPOLOGY = 'otn'
TE_ETH_TRAN_TOPOLOGY = 'eth-tran'
def get_network_topology_type(topology_id : str) -> Optional[NetworkTypeEnum]:
return NetworkTypeEnum._value2member_map_.get(topology_id)
......@@ -22,13 +22,11 @@ from context.client.ContextClient import ContextClient
from nbi.service.rest_server.nbi_plugins.tools.Authentication import HTTP_AUTH
from nbi.service.rest_server.nbi_plugins.tools.HttpStatusCodes import HTTP_OK, HTTP_SERVERERROR
from .YangHandler import YangHandler
from .ManualFixes import manual_fixes
LOGGER = logging.getLogger(__name__)
TE_TOPOLOGY_NAMES = [
'providerId-10-clientId-0-topologyId-1',
'providerId-10-clientId-0-topologyId-2'
]
class Networks(Resource):
......@@ -38,13 +36,8 @@ class Networks(Resource):
topology_id = ''
try:
context_client = ContextClient()
#target = get_slice_by_uuid(context_client, vpn_id, rw_copy=True)
#if target is None:
# raise Exception('VPN({:s}) not found in database'.format(str(vpn_id)))
topology_details = get_topology_details(
context_client, DEFAULT_TOPOLOGY_NAME, context_uuid=DEFAULT_CONTEXT_NAME, #rw_copy=True
)
context_client, DEFAULT_TOPOLOGY_NAME)
if topology_details is None:
MSG = 'Topology({:s}/{:s}) not found'
raise Exception(MSG.format(DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME))
......@@ -55,11 +48,8 @@ class Networks(Resource):
network_reply = yang_handler.compose_network(te_topology_name, topology_details)
network_list_reply.append(network_reply)
# TODO: improve these workarounds to enhance performance
yang_handler.destroy()
response = jsonify(network_list_reply)
# Workaround; pyangbind does not allow to set otn_topology / eth-tran-topology
manual_fixes(response)
response.status_code = HTTP_OK
except Exception as e: # pylint: disable=broad-except
......
......@@ -12,184 +12,113 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json, libyang, logging, os, re
import json
import libyang, logging, os
from typing import Any
from common.DeviceTypes import DeviceTypeEnum
from common.proto.context_pb2 import TopologyDetails, Device, Link, EndPoint
from common.proto.context_pb2 import TopologyDetails, Device, Link
from .NameMapping import NameMappings
from .NetworkTypeEnum import NetworkTypeEnum, get_network_topology_type
from context.client.ContextClient import ContextClient
from common.tools.object_factory.Device import json_device_id
from common.proto.context_pb2 import DeviceId
LOGGER = logging.getLogger(__name__)
YANG_DIR = os.path.join(os.path.dirname(__file__), 'yang')
YANG_MODULES = [
'ietf-network',
'ietf-network-topology'
'ietf-network-topology',
'ietf-l3-unicast-topology'
]
MAPPINGS_TE_NODE_NAME = {
'10.0.10.1' : 'OA',
'10.0.20.1' : 'P',
'10.0.30.1' : 'OE',
'10.0.40.1' : 'P',
'128.32.10.1': 'ONT1',
'128.32.20.1': 'ONT2',
'128.32.33.5': 'OLT',
}
IGNORE_ENDPOINT_NAMES = {'mgmt', 'eth1'}
IGNORE_DEVICE_TYPES = {
DeviceTypeEnum.CLIENT.value,
DeviceTypeEnum.DATACENTER.value,
DeviceTypeEnum.EMULATED_CLIENT.value,
DeviceTypeEnum.EMULATED_DATACENTER.value,
DeviceTypeEnum.EMULATED_IP_SDN_CONTROLLER,
DeviceTypeEnum.EMULATED_MICROWAVE_RADIO_SYSTEM.value,
DeviceTypeEnum.EMULATED_OPEN_LINE_SYSTEM.value,
DeviceTypeEnum.EMULATED_XR_CONSTELLATION.value,
DeviceTypeEnum.IP_SDN_CONTROLLER,
DeviceTypeEnum.MICROWAVE_RADIO_SYSTEM.value,
DeviceTypeEnum.NETWORK.value,
DeviceTypeEnum.OPEN_LINE_SYSTEM.value,
DeviceTypeEnum.XR_CONSTELLATION.value,
}
IGNORE_DEVICE_NAMES = {
NetworkTypeEnum.TE_OTN_TOPOLOGY: {
'nce-t', '128.32.10.1', '128.32.33.5', '128.32.20.5', '128.32.20.1', '128.32.10.5',
},
NetworkTypeEnum.TE_ETH_TRAN_TOPOLOGY: {
'nce-t',
},
}
TE_TOPOLOGY_NAME = 'Huawei-Network'
class YangHandler:
def __init__(self) -> None:
self._yang_context = libyang.Context(YANG_DIR)
for yang_module_name in YANG_MODULES:
LOGGER.info('Loading module: {:s}'.format(str(yang_module_name)))
self._yang_context.load_module(yang_module_name).feature_enable_all()
def get_endpoint_name(self, device: str) -> None:
context_client = ContextClient()
device = context_client.GetDevice(DeviceId(**json_device_id(device)))
def compose_network(self, te_topology_name : str, topology_details : TopologyDetails) -> None:
networks = self._yang_context.create_data_path('/ietf-network:networks')
network = networks.create_path('network[network-id="{:s}"]'.format(te_topology_name))
network.create_path('network-id', te_topology_name)
network_types = network.create_path('network-types') #augmentation, mirar RFC8346
network_types.create_path('ietf-l3-unicast-topology:l3-unicast-topology') #no se si es asi
network.create_path('supporting-network', ) #lista de networks-id, NO SE COMO VERLO
attributes = network.create_path('ietf-l3-unicast-topology:l3-topology-attributes')
#NO SE QUE ATRIBUTOS, CASO ESPECIAL OSPF?
attributes.create_path('name',)
attributes.create_path('flag',)
network_types = network.create_path('network-types')
network_types.create_path('ietf-l3-unicast-topology:l3-unicast-topology')
''' NO SEEEEEE SI HACE FALTA
# TODO: resolve setting of otn_topology/eth_tran_topology network type; not working in bindings.
# See "../ManualFixes.py".
topology_id = ietf_network_obj.te_topology_identifier.topology_id
topology_id = {
'1': NetworkTypeEnum.TE_OTN_TOPOLOGY.value,
'2': NetworkTypeEnum.TE_ETH_TRAN_TOPOLOGY.value,
}.get(topology_id, topology_id)
network_type = get_network_topology_type(topology_id)
if network_type == NetworkTypeEnum.TE_OTN_TOPOLOGY:
#ietf_network_obj.network_types.te_topology.otn_topology._set_present()
pass
elif network_type == NetworkTypeEnum.TE_ETH_TRAN_TOPOLOGY:
#ietf_network_obj.network_types.te_topology.eth_tran_topology._set_present()
pass
else:
raise Exception('Unsupported TopologyId({:s})'.format(str(topology_id)))
'''
name_mappings = NameMappings()
ignore_device_uuids = set()
for device in topology_details.devices:
device_uuid = device.device_id.device_uuid.uuid
device_type = device.device_type
if device_type in IGNORE_DEVICE_TYPES:
ignore_device_uuids.add(device_uuid)
continue
device_name = device.name
if device_name in IGNORE_DEVICE_NAMES.get(network_type, set()): #NETWORK_TYPE?
ignore_device_uuids.add(device_uuid)
continue
for device in topology_details.devices:
self.compose_node(device, name_mappings, network)
for link in topology_details.links:
link_device_uuids = {
endpoint_id.device_id.device_uuid.uuid
for endpoint_id in link.link_endpoint_ids
}
if len(ignore_device_uuids.intersection(link_device_uuids)) > 0:
continue
link_name = link.name
self.compose_link(link_name, link, name_mappings, network)
self.compose_link(link, name_mappings, network)
return json.loads(networks.print_mem('json'))
def compose_node(self, device : Device, name_mappings : NameMappings, network : Any
) -> None:
device_name = device.name
name_mappings.store_device_name(device)
node = network.create_path('node[node-id="{:s}"]'.format(device_name))
node.create_path('node-id', device_name)
#supporting node (nw-ref, node-ref)?
node_attributes = node.create_path('ietf-l3-unicast-topology:l3-node-attributes')
#no se que va en cada atributo
node_attributes.create_path('name',)
node_attributes.create_path('flag',)
node_attributes.create_path('router-id',)
prefix = node_attributes.create_path('prefix[prefix="{:s}"]'.format())
prefix.create_path('prefix',)
prefix.create_path('metric',)
prefix.create_path('flag',)
def compose_node(self, dev: Device, name_mappings: NameMappings, network: Any) -> None:
device_name = dev.name
name_mappings.store_device_name(dev)
node = network.create_path(f'node[node-id="{device_name}"]')
node.create_path('node-id', device_name)
node_attributes = node.create_path('ietf-l3-unicast-topology:l3-node-attributes')
node_attributes.create_path('name', device_name)
for endpoint in device.device_endpoints:
endpoint_name = endpoint.name
if endpoint_name in IGNORE_ENDPOINT_NAMES: continue
context_client = ContextClient()
device = context_client.GetDevice(DeviceId(**json_device_id(device_name)))
tp = node.create_path('ietf-network-topology:termination-point[tp-id="{:s}"]'.format(endpoint_name))
tp.create_path('tp-id', endpoint_name)
#supporting termination point?
tp_attributes = tp.create_path('ietf-l3-unicast-topology:l3-termination-point-attributes')
tp_attributes.create_path('termination-point-type',endpoint.endpoint_type)
def compose_link(self, link_name : Any, link_specs : Link, name_mappings : NameMappings, network : Any
for endpoint in device.device_endpoints:
name_mappings.store_endpoint_name(dev,endpoint)
for config in device.device_config.config_rules:
if config.WhichOneof('config_rule') != 'custom' or '/interface[' not in config.custom.resource_key:
continue
for endpoint in device.device_endpoints:
endpoint_name = endpoint.name
if f'/interface[{endpoint_name}]' in config.custom.resource_key or f'/interface[{endpoint_name}.' in config.custom.resource_key:
interface_name = config.custom.resource_key.split('interface[')[1].split(']')[0]
ip_addresses = []
resource_value = json.loads(config.custom.resource_value)
if 'address_ip' in resource_value:
ip_addresses.append(resource_value['address_ip'])
if 'address_ipv6' in resource_value:
ip_addresses.append(resource_value['address_ipv6'])
if ip_addresses:
tp = node.create_path(f'ietf-network-topology:termination-point[tp-id="{interface_name}"]')
tp.create_path('tp-id', interface_name)
tp_attributes = tp.create_path('ietf-l3-unicast-topology:l3-termination-point-attributes')
for ip in ip_addresses:
tp_attributes.create_path('ip-address', ip)
tp_attributes.create_path('interface-name', endpoint_name)
def compose_link(self, link_specs : Link, name_mappings : NameMappings, network : Any
) -> None:
link_name = link_specs.name
links = network.create_path('ietf-network-topology:link[link-id="{:s}"]'.format(link_name))
links.create_path('link-id', link_name)
src_endpoint_id = link_specs.link_endpoint_ids[0]
LOGGER.info('SRC: {:s}'.format(str(src_endpoint_id)))
source = links.create_path('source')
source.create_path('source_node', name_mappings.get_device_name(src_endpoint_id.device_id))
source.create_path('source_tp', name_mappings.get_endpoint_name(src_endpoint_id))
source.create_path('source-node', name_mappings.get_device_name(src_endpoint_id.device_id))
source.create_path('source-tp', name_mappings.get_endpoint_name(src_endpoint_id))
dst_endpoint_id = link_specs.link_endpoint_ids[-1]
LOGGER.info('DST: {:s}'.format(str(dst_endpoint_id)))
destination = links.create_path('destination')
destination.create_path('dest_node', name_mappings.get_device_name(dst_endpoint_id.device_id))
destination.create_path('dest_tp', name_mappings.get_endpoint_name(dst_endpoint_id))
destination.create_path('dest-node', name_mappings.get_device_name(dst_endpoint_id.device_id))
destination.create_path('dest-tp', name_mappings.get_endpoint_name(dst_endpoint_id))
#supporting-link???
link_attributes = links.create_path('ietf-l3-unicast-topology:l3-link-attributes')
#no se que atributos poner
link_attributes.create_path('name',)
link_attributes.create_path('flag',)
link_attributes.create_path('metric',)
# link_attributes = links.create_path('ietf-l3-unicast-topology:l3-link-attributes')
# link_attributes.create_path('name', link_name)
def destroy(self) -> None:
self._yang_context.destroy()
\ No newline at end of file
module ietf-eth-tran-types {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-eth-tran-types";
prefix "etht-types";
organization
"Internet Engineering Task Force (IETF) CCAMP WG";
contact
"
WG List: <mailto:ccamp@ietf.org>
ID-draft editor:
Haomian Zheng (zhenghaomian@huawei.com);
Italo Busi (italo.busi@huawei.com);
Aihua Guo (aihuaguo.ietf@gmail.com);
Anton Snitser (antons@sedonasys.com);
Francesco Lazzeri (francesco.lazzeri@ericsson.com);
Yunbin Xu (xuyunbin@caict.ac.cn);
Yang Zhao (zhaoyangyjy@chinamobile.com);
Xufeng Liu (xufeng.liu.ietf@gmail.com);
Giuseppe Fioccola (giuseppe.fioccola@huawei.com);
Chaode Yu (yuchaode@huawei.com)
";
description
"This module defines the ETH types.
The model fully conforms to the Network Management
Datastore Architecture (NMDA).
Copyright (c) 2019 IETF Trust and the persons
identified as authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX; see
the RFC itself for full legal notices.";
revision 2023-10-23 {
description
"version -05 as a WG draft";
reference
"draft-ietf-ccamp-client-signal-yang";
}
/*
* Identities
*/
identity eth-vlan-tag-type {
description
"ETH VLAN tag type.";
}
identity c-vlan-tag-type {
base eth-vlan-tag-type;
description
"802.1Q Customer VLAN";
}
identity s-vlan-tag-type {
base eth-vlan-tag-type;
description
"802.1Q Service VLAN (QinQ)";
}
identity service-classification-type {
description
"Service classification.";
}
identity port-classification {
base service-classification-type;
description
"Port classification.";
}
identity vlan-classification {
base service-classification-type;
description
"VLAN classification.";
}
identity eth-vlan-tag-classify {
description
"VLAN tag classification.";
}
identity classify-c-vlan {
base eth-vlan-tag-classify;
description
"Classify 802.1Q Customer VLAN tag.
Only C-tag type is accepted";
}
identity classify-s-vlan {
base eth-vlan-tag-classify;
description
"Classify 802.1Q Service VLAN (QinQ) tag.
Only S-tag type is accepted";
}
identity classify-s-or-c-vlan {
base eth-vlan-tag-classify;
description
"Classify S-VLAN or C-VLAN tag-classify.
Either tag is accepted";
}
identity bandwidth-profile-type-ir {
description
"Bandwidth Profile Types";
}
identity mef-10-bwp {
base bandwidth-profile-type-ir;
description
"MEF 10 Bandwidth Profile";
}
identity rfc-2697-bwp {
base bandwidth-profile-type-ir;
description
"RFC 2697 Bandwidth Profile";
}
identity rfc-2698-bwp {
base bandwidth-profile-type-ir;
description
"RFC 2698 Bandwidth Profile";
}
identity rfc-4115-bwp {
base bandwidth-profile-type-ir;
description
"RFC 4115 Bandwidth Profile";
}
identity service-type-ir {
description
"Type of Ethernet service.";
}
identity p2p-svc {
base service-type-ir;
description
"Ethernet point-to-point service (EPL, EVPL).";
}
identity rmp-svc {
base service-type-ir;
description
"Ethernet rooted-multitpoint service (E-TREE, EP-TREE).";
}
identity mp2mp-svc {
base service-type-ir;
description
"Ethernet multipoint-to-multitpoint service (E-LAN, EP-LAN).";
}
identity lifecycle-status-ir {
description
"Lifecycle Status.";
}
identity installed {
base lifecycle-status-ir;
description
"Installed.";
}
identity planned {
base lifecycle-status-ir;
description
"Planned.";
}
identity pending-removal {
base lifecycle-status-ir;
description
"Pending Removal.";
}
/*
* Type Definitions
*/
typedef eth-tag-type {
type identityref {
base eth-vlan-tag-type;
}
description
"Identifies a specific ETH VLAN tag type.";
}
typedef eth-tag-classify {
type identityref {
base eth-vlan-tag-classify;
}
description
"Identifies a specific VLAN tag classification.";
}
typedef vlanid {
type uint16 {
range "1..4094";
}
description
"The 12-bit VLAN-ID used in the VLAN Tag header.";
}
typedef vid-range-type {
type string {
pattern "([1-9][0-9]{0,3}(-[1-9][0-9]{0,3})?" +
"(,[1-9][0-9]{0,3}(-[1-9][0-9]{0,3})?)*)";
}
description
"A list of VLAN Ids, or non overlapping VLAN ranges, in
ascending order, between 1 and 4094.
This type is used to match an ordered list of VLAN Ids, or
contiguous ranges of VLAN Ids. Valid VLAN Ids must be in the
range 1 to 4094, and included in the list in non overlapping
ascending order.
For example: 1,10-100,50,500-1000";
}
typedef bandwidth-profile-type {
type identityref {
base bandwidth-profile-type-ir;
}
description
"Identifies a specific Bandwidth Profile type.";
}
typedef service-type {
type identityref {
base service-type-ir;
}
description
"Identifies the type of Ethernet service.";
}
typedef lifecycle-status {
type identityref {
base lifecycle-status-ir;
}
description
"Identifies the lLifecycle Status .";
}
/*
* Grouping Definitions
*/
grouping etht-bandwidth-profiles {
description
"Bandwidth profile configuration paramters.";
leaf bandwidth-profile-type {
type etht-types:bandwidth-profile-type;
description
"The type of bandwidth profile.";
}
leaf CIR {
type uint64;
description
"Committed Information Rate in Kbps";
}
leaf CBS {
type uint64;
description
"Committed Burst Size in in KBytes";
}
leaf EIR {
type uint64;
/* Need to indicate that EIR is not supported by RFC 2697
must
'../bw-profile-type = "mef-10-bwp" or ' +
'../bw-profile-type = "rfc-2698-bwp" or ' +
'../bw-profile-type = "rfc-4115-bwp"'
must
'../bw-profile-type != "rfc-2697-bwp"'
*/
description
"Excess Information Rate in Kbps
In case of RFC 2698, PIR = CIR + EIR";
}
leaf EBS {
type uint64;
description
"Excess Burst Size in KBytes.
In case of RFC 2698, PBS = CBS + EBS";
}
leaf color-aware {
type boolean;
description
"Indicates weather the color-mode is
color-aware or color-blind.";
}
leaf coupling-flag {
type boolean;
/* Need to indicate that Coupling Flag is defined only for MEF 10
must
'../bw-profile-type = "mef-10-bwp"'
*/
description
"Coupling Flag.";
}
}
identity topology-role {
description
"The role of underlay topology: e.g., hub, spoke,
any-to-any.";
}
identity resilience {
description
"Placeholder for resilience information in data plane,
for future study. ";
}
identity access-role {
description
"Indicating whether the access is a working or protection access.";
}
identity root-primary {
base access-role;
description
"Designates the primary root UNI of an E-Tree service, and may also
designates the UNI access role of E-LINE and E-LAN service.";
}
identity root-backup {
base access-role;
description
"Designates the backup root UNI of an E-Tree service.";
}
identity leaf-access {
base access-role;
description
"Designates the leaf UNI of an E-Tree service.";
}
identity leaf-edge {
base access-role;
description "";
}
identity performance {
description
"Placeholder for performance information, for future study.";
}
identity encapsulation-type {
description
"Indicating how the service is encapsulated (to PW), e.g, raw or tag. ";
}
grouping pw-segement-bandwidth-profile-grouping {
description
"bandwidth profile grouping for PW segment. ";
leaf bandwidth-profile-type {
type etht-types:bandwidth-profile-type;
description
"The type of bandwidth profile.";
}
leaf CIR {
type uint64;
description
"Committed Information Rate in Kbps";
}
leaf CBS {
type uint64;
description
"Committed Burst Size in in KBytes";
}
leaf EIR {
type uint64;
/* Need to indicate that EIR is not supported by RFC 2697
must
'../bw-profile-type = "mef-10-bwp" or ' +
'../bw-profile-type = "rfc-2698-bwp" or ' +
'../bw-profile-type = "rfc-4115-bwp"'
must
'../bw-profile-type != "rfc-2697-bwp"'
*/
description
"Excess Information Rate in Kbps
In case of RFC 2698, PIR = CIR + EIR";
}
leaf EBS {
type uint64;
description
"Excess Burst Size in KBytes.
In case of RFC 2698, PBS = CBS + EBS";
}
}
grouping eth-bandwidth {
description
"Available bandwith for ethernet.";
leaf eth-bandwidth {
type uint64{
range "0..10000000000";
}
units "Kbps";
description
"Available bandwith value expressed in kilobits per second";
}
}
grouping eth-label-restriction {
description
"Label Restriction for ethernet.";
leaf tag-type {
type etht-types:eth-tag-type;
description "VLAN tag type.";
}
leaf priority {
type uint8;
description "priority.";
}
}
grouping eth-label {
description
"Label for ethernet.";
leaf vlanid {
type etht-types:vlanid;
description
"VLAN tag id.";
}
}
grouping eth-label-step {
description "Label step for Ethernet VLAN";
leaf eth-step {
type uint16 {
range "1..4095";
}
default 1;
description
"Label step which represent possible increments for
an Ethernet VLAN tag.";
reference
"IEEE 802.1ad: Provider Bridges.";
}
}
}
module ietf-l3-unicast-topology {
yang-version 1.1;
namespace
"urn:ietf:params:xml:ns:yang:ietf-l3-unicast-topology";
prefix "l3t";
import ietf-network {
prefix "nw";
}
import ietf-network-topology {
prefix "nt";
}
import ietf-inet-types {
prefix "inet";
}
import ietf-routing-types {
prefix "rt-types";
}
organization
"IETF I2RS (Interface to the Routing System) Working Group";
contact
"WG Web: <https://datatracker.ietf.org/wg/i2rs/>
WG List: <mailto:i2rs@ietf.org>
Editor: Alexander Clemm
<mailto:ludwig@clemm.org>
Editor: Jan Medved
<mailto:jmedved@cisco.com>
Editor: Robert Varga
<mailto:robert.varga@pantheon.tech>
Editor: Xufeng Liu
<mailto:xufeng.liu.ietf@gmail.com>
Editor: Nitin Bahadur
<mailto:nitin_bahadur@yahoo.com>
Editor: Hariharan Ananthakrishnan
<mailto:hari@packetdesign.com>";
description
"This module defines a model for Layer 3 Unicast
topologies.
Copyright (c) 2018 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of
RFC 8346; see the RFC itself for full legal notices.";
revision "2018-02-26" {
description
"Initial revision.";
reference
"RFC 8346: A YANG Data Model for Layer 3 Topologies";
}
identity flag-identity {
description "Base type for flags";
}
typedef l3-event-type {
type enumeration {
enum "add" {
description
"A Layer 3 node, link, prefix, or termination point has
been added";
}
enum "remove" {
description
"A Layer 3 node, link, prefix, or termination point has
been removed";
}
enum "update" {
description
"A Layer 3 node, link, prefix, or termination point has
been updated";
}
}
description "Layer 3 event type for notifications";
}
typedef prefix-flag-type {
type identityref {
base "flag-identity";
}
description "Prefix flag attributes";
}
typedef node-flag-type {
type identityref {
base "flag-identity";
}
description "Node flag attributes";
}
typedef link-flag-type {
type identityref {
base "flag-identity";
}
description "Link flag attributes";
}
typedef l3-flag-type {
type identityref {
base "flag-identity";
}
description "L3 flag attributes";
}
grouping l3-prefix-attributes {
description
"L3 prefix attributes";
leaf prefix {
type inet:ip-prefix;
description
"IP prefix value";
}
leaf metric {
type uint32;
description
"Prefix metric";
}
leaf-list flag {
type prefix-flag-type;
description
"Prefix flags";
}
}
grouping l3-unicast-topology-type {
description "Identifies the topology type to be L3 Unicast.";
container l3-unicast-topology {
presence "indicates L3 Unicast topology";
description
"The presence of the container node indicates L3 Unicast
topology";
}
}
grouping l3-topology-attributes {
description "Topology scope attributes";
container l3-topology-attributes {
description "Contains topology attributes";
leaf name {
type string;
description
"Name of the topology";
}
leaf-list flag {
type l3-flag-type;
description
"Topology flags";
}
}
}
grouping l3-node-attributes {
description "L3 node scope attributes";
container l3-node-attributes {
description
"Contains node attributes";
leaf name {
type inet:domain-name;
description
"Node name";
}
leaf-list flag {
type node-flag-type;
description
"Node flags";
}
leaf-list router-id {
type rt-types:router-id;
description
"Router-id for the node";
}
list prefix {
key "prefix";
description
"A list of prefixes along with their attributes";
uses l3-prefix-attributes;
}
}
}
grouping l3-link-attributes {
description
"L3 link scope attributes";
container l3-link-attributes {
description
"Contains link attributes";
leaf name {
type string;
description
"Link Name";
}
leaf-list flag {
type link-flag-type;
description
"Link flags";
}
leaf metric1 {
type uint64;
description
"Link Metric 1";
}
leaf metric2 {
type uint64;
description
"Link Metric 2";
}
}
}
grouping l3-termination-point-attributes {
description "L3 termination point scope attributes";
container l3-termination-point-attributes {
description
"Contains termination point attributes";
choice termination-point-type {
description
"Indicates the termination point type";
case ip {
leaf-list ip-address {
type inet:ip-address;
description
"IPv4 or IPv6 address.";
}
}
case unnumbered {
leaf unnumbered-id {
type uint32;
description
"Unnumbered interface identifier.
The identifier will correspond to the ifIndex value
of the interface, i.e., the ifIndex value of the
ifEntry that represents the interface in
implementations where the Interfaces Group MIB
(RFC 2863) is supported.";
reference
"RFC 2863: The Interfaces Group MIB";
}
}
case interface-name {
leaf interface-name {
type string;
description
"Name of the interface. The name can (but does not
have to) correspond to an interface reference of a
containing node's interface, i.e., the path name of a
corresponding interface data node on the containing
node reminiscent of data type interface-ref defined
in RFC 8343. It should be noted that data type
interface-ref of RFC 8343 cannot be used directly,
as this data type is used to reference an interface
in a datastore of a single node in the network, not
to uniquely reference interfaces across a network.";
reference
"RFC 8343: A YANG Data Model for Interface Management";
}
}
}
}
}
augment "/nw:networks/nw:network/nw:network-types" {
description
"Introduces new network type for L3 Unicast topology";
uses l3-unicast-topology-type;
}
augment "/nw:networks/nw:network" {
when "nw:network-types/l3t:l3-unicast-topology" {
description
"Augmentation parameters apply only for networks with
L3 Unicast topology";
}
description
"L3 Unicast for the network as a whole";
uses l3-topology-attributes;
}
augment "/nw:networks/nw:network/nw:node" {
when "../nw:network-types/l3t:l3-unicast-topology" {
description
"Augmentation parameters apply only for networks with
L3 Unicast topology";
}
description
"L3 Unicast node-level attributes ";
uses l3-node-attributes;
}
augment "/nw:networks/nw:network/nt:link" {
when "../nw:network-types/l3t:l3-unicast-topology" {
description
"Augmentation parameters apply only for networks with
L3 Unicast topology";
}
description
"Augments topology link attributes";
uses l3-link-attributes;
}
augment "/nw:networks/nw:network/nw:node/"
+"nt:termination-point" {
when "../../nw:network-types/l3t:l3-unicast-topology" {
description
"Augmentation parameters apply only for networks with
L3 Unicast topology";
}
description "Augments topology termination point configuration";
uses l3-termination-point-attributes;
}
notification l3-node-event {
description
"Notification event for L3 node";
leaf l3-event-type {
type l3-event-type;
description
"Event type";
}
uses nw:node-ref;
uses l3-unicast-topology-type;
uses l3-node-attributes;
}
notification l3-link-event {
description
"Notification event for L3 link";
leaf l3-event-type {
type l3-event-type;
description
"Event type";
}
uses nt:link-ref;
uses l3-unicast-topology-type;
uses l3-link-attributes;
}
notification l3-prefix-event {
description
"Notification event for L3 prefix";
leaf l3-event-type {
type l3-event-type;
description
"Event type";
}
uses nw:node-ref;
uses l3-unicast-topology-type;
container prefix {
description
"Contains L3 prefix attributes";
uses l3-prefix-attributes;
}
}
notification termination-point-event {
description
"Notification event for L3 termination point";
leaf l3-event-type {
type l3-event-type;
description
"Event type";
}
uses nt:tp-ref;
uses l3-unicast-topology-type;
uses l3-termination-point-attributes;
}
}
module ietf-te-packet-types {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-te-packet-types";
prefix te-packet-types;
/* Import TE generic types */
import ietf-te-types {
prefix te-types;
reference
"RFC 8776: Common YANG Data Types for Traffic Engineering";
}
organization
"IETF Traffic Engineering Architecture and Signaling (TEAS)
Working Group";
contact
"WG Web: <https://datatracker.ietf.org/wg/teas/>
WG List: <mailto:teas@ietf.org>
Editor: Tarek Saad
<mailto:tsaad@juniper.net>
Editor: Rakesh Gandhi
<mailto:rgandhi@cisco.com>
Editor: Vishnu Pavan Beeram
<mailto:vbeeram@juniper.net>
Editor: Xufeng Liu
<mailto:xufeng.liu.ietf@gmail.com>
Editor: Igor Bryskin
<mailto:i_bryskin@yahoo.com>";
description
"This YANG module contains a collection of generally useful YANG
data type definitions specific to MPLS TE. The model fully
conforms to the Network Management Datastore Architecture
(NMDA).
Copyright (c) 2020 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject to
the license terms contained in, the Simplified BSD License set
forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC 8776; see the
RFC itself for full legal notices.";
revision 2020-06-10 {
description
"Latest revision of TE MPLS types.";
reference
"RFC 8776: Common YANG Data Types for Traffic Engineering";
}
/**
* Typedefs
*/
typedef te-bandwidth-requested-type {
type enumeration {
enum specified {
description
"Bandwidth is explicitly specified.";
}
enum auto {
description
"Bandwidth is automatically computed.";
}
}
description
"Enumerated type for specifying whether bandwidth is
explicitly specified or automatically computed.";
}
typedef te-class-type {
type uint8;
description
"Diffserv-TE Class-Type. Defines a set of Traffic Trunks
crossing a link that is governed by a specific set of
bandwidth constraints. Class-Type is used for the purposes
of link bandwidth allocation, constraint-based routing, and
admission control.";
reference
"RFC 4124: Protocol Extensions for Support of Diffserv-aware
MPLS Traffic Engineering";
}
typedef bc-type {
type uint8 {
range "0..7";
}
description
"Diffserv-TE bandwidth constraints as defined in RFC 4124.";
reference
"RFC 4124: Protocol Extensions for Support of Diffserv-aware
MPLS Traffic Engineering";
}
typedef bandwidth-kbps {
type uint64;
units "Kbps";
description
"Bandwidth values, expressed in kilobits per second.";
}
typedef bandwidth-mbps {
type uint64;
units "Mbps";
description
"Bandwidth values, expressed in megabits per second.";
}
typedef bandwidth-gbps {
type uint64;
units "Gbps";
description
"Bandwidth values, expressed in gigabits per second.";
}
identity backup-protection-type {
description
"Base identity for the backup protection type.";
}
identity backup-protection-link {
base backup-protection-type;
description
"Backup provides link protection only.";
}
identity backup-protection-node-link {
base backup-protection-type;
description
"Backup offers node (preferred) or link protection.";
}
identity bc-model-type {
description
"Base identity for the Diffserv-TE Bandwidth Constraints
Model type.";
reference
"RFC 4124: Protocol Extensions for Support of Diffserv-aware
MPLS Traffic Engineering";
}
identity bc-model-rdm {
base bc-model-type;
description
"Russian Dolls Bandwidth Constraints Model type.";
reference
"RFC 4127: Russian Dolls Bandwidth Constraints Model for
Diffserv-aware MPLS Traffic Engineering";
}
identity bc-model-mam {
base bc-model-type;
description
"Maximum Allocation Bandwidth Constraints Model type.";
reference
"RFC 4125: Maximum Allocation Bandwidth Constraints Model for
Diffserv-aware MPLS Traffic Engineering";
}
identity bc-model-mar {
base bc-model-type;
description
"Maximum Allocation with Reservation Bandwidth Constraints
Model type.";
reference
"RFC 4126: Max Allocation with Reservation Bandwidth
Constraints Model for Diffserv-aware MPLS Traffic Engineering
& Performance Comparisons";
}
grouping performance-metrics-attributes-packet {
description
"Contains PM attributes.";
uses te-types:performance-metrics-attributes {
augment "performance-metrics-one-way" {
leaf one-way-min-delay {
type uint32 {
range "0..16777215";
}
description
"One-way minimum delay or latency in microseconds.";
}
leaf one-way-min-delay-normality {
type te-types:performance-metrics-normality;
default "normal";
description
"One-way minimum delay or latency normality.";
}
leaf one-way-max-delay {
type uint32 {
range "0..16777215";
}
description
"One-way maximum delay or latency in microseconds.";
}
leaf one-way-max-delay-normality {
type te-types:performance-metrics-normality;
default "normal";
description
"One-way maximum delay or latency normality.";
}
leaf one-way-delay-variation {
type uint32 {
range "0..16777215";
}
description
"One-way delay variation in microseconds.";
reference
"RFC 5481: Packet Delay Variation Applicability
Statement, Section 4.2";
}
leaf one-way-delay-variation-normality {
type te-types:performance-metrics-normality;
default "normal";
description
"One-way delay variation normality.";
reference
"RFC 7471: OSPF Traffic Engineering (TE) Metric
Extensions
RFC 7823: Performance-Based Path Selection for
Explicitly Routed Label Switched Paths (LSPs) Using
TE Metric Extensions
RFC 8570: IS-IS Traffic Engineering (TE) Metric
Extensions";
}
leaf one-way-packet-loss {
type decimal64 {
fraction-digits 6;
range "0..50.331642";
}
description
"One-way packet loss as a percentage of the total traffic
sent over a configurable interval. The finest precision
is 0.000003%, where the maximum is 50.331642%.";
reference
"RFC 8570: IS-IS Traffic Engineering (TE) Metric
Extensions, Section 4.4";
}
leaf one-way-packet-loss-normality {
type te-types:performance-metrics-normality;
default "normal";
description
"Packet loss normality.";
reference
"RFC 7471: OSPF Traffic Engineering (TE) Metric
Extensions
RFC 7823: Performance-Based Path Selection for
Explicitly Routed Label Switched Paths (LSPs) Using
TE Metric Extensions
RFC 8570: IS-IS Traffic Engineering (TE) Metric
Extensions";
}
description
"PM one-way packet-specific augmentation for a generic PM
grouping.";
}
augment "performance-metrics-two-way" {
leaf two-way-min-delay {
type uint32 {
range "0..16777215";
}
default "0";
description
"Two-way minimum delay or latency in microseconds.";
}
leaf two-way-min-delay-normality {
type te-types:performance-metrics-normality;
default "normal";
description
"Two-way minimum delay or latency normality.";
reference
"RFC 7471: OSPF Traffic Engineering (TE) Metric
Extensions
RFC 7823: Performance-Based Path Selection for
Explicitly Routed Label Switched Paths (LSPs) Using
TE Metric Extensions
RFC 8570: IS-IS Traffic Engineering (TE) Metric
Extensions";
}
leaf two-way-max-delay {
type uint32 {
range "0..16777215";
}
default "0";
description
"Two-way maximum delay or latency in microseconds.";
}
leaf two-way-max-delay-normality {
type te-types:performance-metrics-normality;
default "normal";
description
"Two-way maximum delay or latency normality.";
reference
"RFC 7471: OSPF Traffic Engineering (TE) Metric
Extensions
RFC 7823: Performance-Based Path Selection for
Explicitly Routed Label Switched Paths (LSPs) Using
TE Metric Extensions
RFC 8570: IS-IS Traffic Engineering (TE) Metric
Extensions";
}
leaf two-way-delay-variation {
type uint32 {
range "0..16777215";
}
default "0";
description
"Two-way delay variation in microseconds.";
reference
"RFC 5481: Packet Delay Variation Applicability
Statement, Section 4.2";
}
leaf two-way-delay-variation-normality {
type te-types:performance-metrics-normality;
default "normal";
description
"Two-way delay variation normality.";
reference
"RFC 7471: OSPF Traffic Engineering (TE) Metric
Extensions
RFC 7823: Performance-Based Path Selection for
Explicitly Routed Label Switched Paths (LSPs) Using
TE Metric Extensions
RFC 8570: IS-IS Traffic Engineering (TE) Metric
Extensions";
}
leaf two-way-packet-loss {
type decimal64 {
fraction-digits 6;
range "0..50.331642";
}
default "0";
description
"Two-way packet loss as a percentage of the total traffic
sent over a configurable interval. The finest precision
is 0.000003%.";
}
leaf two-way-packet-loss-normality {
type te-types:performance-metrics-normality;
default "normal";
description
"Two-way packet loss normality.";
}
description
"PM two-way packet-specific augmentation for a generic PM
grouping.";
reference
"RFC 7471: OSPF Traffic Engineering (TE) Metric Extensions
RFC 7823: Performance-Based Path Selection for
Explicitly Routed Label Switched Paths (LSPs) Using
TE Metric Extensions
RFC 8570: IS-IS Traffic Engineering (TE) Metric
Extensions";
}
}
}
grouping one-way-performance-metrics-packet {
description
"One-way packet PM throttle grouping.";
leaf one-way-min-delay {
type uint32 {
range "0..16777215";
}
default "0";
description
"One-way minimum delay or latency in microseconds.";
}
leaf one-way-max-delay {
type uint32 {
range "0..16777215";
}
default "0";
description
"One-way maximum delay or latency in microseconds.";
}
leaf one-way-delay-variation {
type uint32 {
range "0..16777215";
}
default "0";
description
"One-way delay variation in microseconds.";
}
leaf one-way-packet-loss {
type decimal64 {
fraction-digits 6;
range "0..50.331642";
}
default "0";
description
"One-way packet loss as a percentage of the total traffic
sent over a configurable interval. The finest precision is
0.000003%.";
}
}
grouping two-way-performance-metrics-packet {
description
"Two-way packet PM throttle grouping.";
leaf two-way-min-delay {
type uint32 {
range "0..16777215";
}
default "0";
description
"Two-way minimum delay or latency in microseconds.";
}
leaf two-way-max-delay {
type uint32 {
range "0..16777215";
}
default "0";
description
"Two-way maximum delay or latency in microseconds.";
}
leaf two-way-delay-variation {
type uint32 {
range "0..16777215";
}
default "0";
description
"Two-way delay variation in microseconds.";
}
leaf two-way-packet-loss {
type decimal64 {
fraction-digits 6;
range "0..50.331642";
}
default "0";
description
"Two-way packet loss as a percentage of the total traffic
sent over a configurable interval. The finest precision is
0.000003%.";
}
}
grouping performance-metrics-throttle-container-packet {
description
"Packet PM threshold grouping.";
uses te-types:performance-metrics-throttle-container {
augment "throttle/threshold-out" {
uses one-way-performance-metrics-packet;
uses two-way-performance-metrics-packet;
description
"PM threshold-out packet augmentation for a
generic grouping.";
}
augment "throttle/threshold-in" {
uses one-way-performance-metrics-packet;
uses two-way-performance-metrics-packet;
description
"PM threshold-in packet augmentation for a
generic grouping.";
}
augment "throttle/threshold-accelerated-advertisement" {
uses one-way-performance-metrics-packet;
uses two-way-performance-metrics-packet;
description
"PM accelerated advertisement packet augmentation for a
generic grouping.";
}
}
}
}
module ietf-trans-client-svc-types {
namespace "urn:ietf:params:xml:ns:yang:ietf-trans-client-svc-types";
prefix "clntsvc-types";
organization
"Internet Engineering Task Force (IETF) CCAMP WG";
contact
"
ID-draft editor:
Haomian Zheng (zhenghaomian@huawei.com);
Aihua Guo (aihuaguo.ietf@gmail.com);
Italo Busi (italo.busi@huawei.com);
Anton Snitser (antons@sedonasys.com);
Francesco Lazzeri (francesco.lazzeri@ericsson.com);
Yunbin Xu (xuyunbin@caict.ac.cn);
Yang Zhao (zhaoyangyjy@chinamobile.com);
Xufeng Liu (Xufeng_Liu@jabil.com);
Giuseppe Fioccola (giuseppe.fioccola@huawei.com);
Chaode Yu (yuchaode@huawei.com);
";
description
"This module defines a YANG data model for describing
transport network client types. The model fully conforms
to the Network Management Datastore Architecture (NMDA).
Copyright (c) 2019 IETF Trust and the persons
identified as authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX; see
the RFC itself for full legal notices.";
revision 2023-10-23 {
description
"version -01 as a WG document";
reference
"draft-ietf-ccamp-client-signal-yang";
}
identity direction {
description
"Direction information of Client Signal.";
}
identity bidirectional {
base direction;
description
"Client Signal is bi-directional.";
}
identity unidirectional {
base direction;
description
"Client Signal is uni-directional.";
}
}
......@@ -14,6 +14,7 @@
from nbi.service.rest_server.RestServer import RestServer
from nbi.service.rest_server.nbi_plugins.ietf_hardware import Hardware, HardwareMultipleDevices
from nbi.service.rest_server.nbi_plugins.ietf_network_new import Networks
from .Resources import (
Connection, ConnectionIds, Connections,
Context, ContextIds, Contexts,
......@@ -64,6 +65,8 @@ RESOURCES = [
('api.policyrule_ids', PolicyRuleIds, '/policyrule_ids'),
('api.policyrules', PolicyRules, '/policyrules'),
('api.policyrule', PolicyRule, '/policyrule/<path:policyrule_uuid>'),
('api.networksl3' , Networks, '/networks')
]
def register_tfs_api(rest_server : RestServer):
......
......@@ -24,6 +24,7 @@
<li><a class="nav-link" href="/tfs-api/dummy_contexts" id="dummy_contexts_link" target="dummy_contexts">Dummy Contexts</a></li>
<li><a class="nav-link" href="/tfs-api/devices" id="devices_link" target="devices">Devices</a></li>
<li><a class="nav-link" href="/tfs-api/links" id="links_link" target="links">Links</a></li>
<li><a class="nav-link" href="/tfs-api/networks" id="networks_link" target="networks">Networks</a></li>
</ul>
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment