Skip to content
Snippets Groups Projects
Commit 99a8cd69 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'develop' of https://gitlab.com/teraflow-h2020/controller into...

Merge branch 'develop' of https://gitlab.com/teraflow-h2020/controller into feat/ecoc22-dc-interconnect-disjoint
parents e001c72f ee3bfcf3
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!4Compute component:
#!/bin/bash
./report_coverage_all.sh | grep --color -E -i "^slice/.*$|$"
import grpc, logging
from typing import Dict, List, Set, Tuple
from common.Checkers import chk_string
from common.exceptions.ServiceException import ServiceException
from service.proto.context_pb2 import Constraint
def check_constraint(
logger : logging.Logger, constraint_number : int, parent_name : str, constraint : Constraint,
add_constraints : Dict[str, Dict[str, Set[str]]]) -> Tuple[str, str]:
try:
constraint_type = chk_string('constraint[#{}].constraint_type'.format(constraint_number),
constraint.constraint_type,
allow_empty=False)
constraint_value = chk_string('constraint[#{}].constraint_value'.format(constraint_number),
constraint.constraint_value,
allow_empty=False)
except Exception as e:
logger.exception('Invalid arguments:')
raise ServiceException(grpc.StatusCode.INVALID_ARGUMENT, str(e))
if constraint_type in add_constraints:
msg = 'Duplicated ConstraintType({}) in {}.'
msg = msg.format(constraint_type, parent_name)
raise ServiceException(grpc.StatusCode.INVALID_ARGUMENT, msg)
add_constraints[constraint_type] = constraint_value
return constraint_type, constraint_value
def check_constraints(logger : logging.Logger, parent_name : str, constraints):
add_constraints : Dict[str, str] = {}
constraint_tuples : List[Tuple[str, str]] = []
for constraint_number,constraint in enumerate(constraints):
_parent_name = 'Constraint(#{}) of {}'.format(constraint_number, parent_name)
constraint_type, constraint_value = check_constraint(
logger, constraint_number, _parent_name, constraint, add_constraints)
constraint_tuples.append((constraint_type, constraint_value))
return constraint_tuples
import grpc
from common.database.api.Database import Database
from common.database.api.context.slice.Slice import Slice
from common.exceptions.ServiceException import ServiceException
def check_slice_exists(database : Database, context_id : str, slice_id : str) -> Slice:
db_context = database.context(context_id).create()
if db_context.slices.contains(slice_id): return db_context.slice(slice_id)
msg = 'Context({})/Slice({}) does not exist in the database.'
msg = msg.format(context_id, slice_id)
raise ServiceException(grpc.StatusCode.NOT_FOUND, msg)
def check_slice_not_exists(database : Database, context_id : str, slice_id : str):
db_context = database.context(context_id).create()
if not db_context.slices.contains(slice_id): return
msg = 'Context({})/Slice({}) already exists in the database.'
msg = msg.format(context_id, slice_id)
raise ServiceException(grpc.StatusCode.ALREADY_EXISTS, msg)
module ietf-network-slice-service {
yang-version 1.1;
namespace
"urn:ietf:params:xml:ns:yang:ietf-network-slice-service";
prefix ietf-nss;
import ietf-inet-types {
prefix inet;
reference
"RFC 6991: Common YANG Types.";
}
import ietf-vpn-common {
prefix vpn-common;
reference
"RFC 9181: A Common YANG Data Model for Layer 2 and Layer 3
VPNs.";
}
import ietf-te-types {
prefix te-types;
reference
"RFC 8776: Common YANG Data Types for Traffic Engineering.";
}
import ietf-te-packet-types {
prefix te-packet-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://tools.ietf.org/wg/teas/>
WG List: <mailto:teas@ietf.org>
Editor: Bo Wu
<lana.wubo@huawei.com>
Editor: Dhruv Dhody
<dhruv.ietf@gmail.com>
Editor: Reza Rokui
<reza.rokui@nokia.com>
Editor: Tarek Saad
<tsaad@juniper.net>
Author: Liuyan Han
<hanliuyan@chinamobile.com>";
description
"This module defines a model for the IETF Network Slice service.
Copyright (c) 2022 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 Revised 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 2022-07-11 {
description
"initial version.";
reference
"RFC XXXX: A Yang Data Model for IETF Network Slice service
operation";
}
/* Features */
/* Identities */
identity service-tag-type {
description
"Base identity for IETF Network Slice service tag type.";
}
identity service-tag-customer {
base service-tag-type;
description
"The IETF Network Slice service customer ID tag type.";
}
identity service-tag-service {
base service-tag-type;
description
"The IETF Network Slice service tag type.";
}
identity service-tag-opaque {
base service-tag-type;
description
"The IETF Network Slice service opaque tag type.";
}
identity attachment-circuit-tag-type {
description
"Base identity for the attachment circuit tag type.";
}
identity attachment-circuit-tag-vlan-id {
base attachment-circuit-tag-type;
description
"The attachment circuit VLAN ID tag type.";
}
identity attachment-circuit-tag-ip-mask {
base attachment-circuit-tag-type;
description
"The attachment circuit tag IP mask.";
}
identity service-isolation-type {
description
"Base identity for IETF Network slice service isolation level.";
}
identity service-isolation-shared {
base service-isolation-type;
description
"Shared resources (e.g. queues) are associated with the
slice service traffic. Hence, the traffic can be impacted
by effects of other services traffic
sharing the same resources.";
}
identity service-isolation-dedicated {
base service-isolation-type;
description
"Dedicated resources (e.g. queues) are associated with the
Network Slice service traffic. Hence, the service traffic
is isolated from other servceis traffic
sharing the same resources.";
}
identity service-security-type {
description
"Base identity for for slice service security level.";
}
identity service-security-authenticate {
base service-security-type;
description
"Indicates the slice service requires authentication.";
}
identity service-security-integrity {
base service-security-type;
description
"Indicates the slice service requires data integrity.";
}
identity service-security-encryption {
base service-security-type;
description
"Indicates the slice service requires data encryption.";
}
identity point-to-point {
base vpn-common:vpn-topology;
description
"Identity for point-to-point IETF Network Slice
service connectivity.";
}
identity point-to-multipoint {
base vpn-common:vpn-topology;
description
"Identity for point-to-point IETF Network Slice
service connectivity.";
}
identity multipoint-to-multipoint {
base vpn-common:vpn-topology;
description
"Identity for point-to-point IETF Network Slice
service connectivity.";
}
identity multipoint-to-point {
base vpn-common:vpn-topology;
description
"Identity for point-to-point IETF Network Slice
service connectivity.";
}
identity sender-role {
base vpn-common:role;
description
"A SDP is acting as a sender.";
}
identity receiver-role {
base vpn-common:role;
description
"A SDP is acting as a receiver.";
}
identity service-slo-metric-type {
description
"Base identity for IETF Network Slice service SLO metric type.";
}
identity service-slo-one-way-bandwidth {
base service-slo-metric-type;
description
"SLO bandwidth metric. Minimum guaranteed bandwidth between
two SDPs at any time and is measured unidirectionally.";
}
identity service-slo-two-way-bandwidth {
base service-slo-metric-type;
description
"SLO bandwidth metric. Minimum guaranteed bandwidth between
two SDPs at any time.";
}
identity service-slo-shared-bandwidth {
base service-slo-metric-type;
description
"The shared SLO bandwidth bound. It is the limit on the
bandwidth that can be shared amongst a group of
connectivity constructs of a slice service.";
}
identity service-slo-one-way-delay {
base service-slo-metric-type;
description
"SLO one-way-delay is the upper bound of network delay when
transmitting between two SDPs. The metric is defined in
RFC7679.";
}
identity service-slo-two-way-delay {
base service-slo-metric-type;
description
"SLO two-way delay is the upper bound of network delay when
transmitting between two SDPs. The metric is defined in
RFC2681.";
}
identity service-slo-one-way-delay-variation {
base service-slo-metric-type;
description
"SLO one-way delay variation is defined by RFC3393, is the
difference in the one-way delay between sequential packets
between two SDPs.";
}
identity service-slo-two-way-delay-variation {
base service-slo-metric-type;
description
"SLO two-way delay variation is defined by RFC5481, is the
difference in the round-trip delay between sequential packets
between two SDPs.";
}
identity service-slo-one-way-packet-loss {
base service-slo-metric-type;
description
"SLO loss metric. The ratio of packets dropped to packets
transmitted between two SDPs in one-way
over a period of time as specified in RFC7680.";
}
identity service-slo-two-way-packet-loss {
base service-slo-metric-type;
description
"SLO loss metric. The ratio of packets dropped to packets
transmitted between two SDPs in two-way
over a period of time as specified in RFC7680.";
}
identity service-slo-availability {
base service-slo-metric-type;
description
"SLO availability level.";
}
identity service-match-type {
description
"Base identity for IETF Network Slice service traffic
match type.";
}
identity service-phy-interface-match {
base service-match-type;
description
"Use the physical interface as match criteria for
slice service traffic.";
}
identity service-vlan-match {
base service-match-type;
description
"Use the VLAN ID as match criteria for the slice service
traffic.";
}
identity service-label-match {
base service-match-type;
description
"Use the MPLS label as match criteria for the slice service
traffic.";
}
identity service-source-ip-match {
base service-match-type;
description
"Use source ip-address in the packet header as match criteria
for the slice service traffic.";
}
identity service-destination-ip-match {
base service-match-type;
description
"Use destination ip-address in the packet header as
match criteria for the slice service traffic.";
}
identity service-dscp-match {
base service-match-type;
description
"Use DSCP in the IP packet header as match criteria
for the slice service traffic.";
}
identity service-any-match {
base service-match-type;
description
"Match all slice service traffic.";
}
identity peering-protocol-type {
description
"Base identity for SDP peering protocol type.";
}
identity peering-protocol-bgp {
base peering-protocol-type;
description
"Use BGP as protocol for SDP peering with customer device.";
}
identity peering-static-routing {
base peering-protocol-type;
description
"Use static routing for SDP peering with customer device.";
}
identity peering-attribute-type {
description
"Base identity for BGP peering";
}
identity remote-as {
base peering-attribute-type;
description
"Identity for remote-as attribute of BGP peering.";
}
identity neighbor {
base peering-attribute-type;
description
"Identity for neighbor attribute of BGP peering.";
}
identity local-as {
base peering-attribute-type;
description
"Identity for local-as attribute of BGP peering.";
}
/*
* Identity for availability-type
*/
identity availability-type {
description
"Base identity from which specific availability types are
derived.";
}
identity level-1 {
base availability-type;
description
"level 1: 99.9999%";
}
identity level-2 {
base availability-type;
description
"level 2: 99.999%";
}
identity level-3 {
base availability-type;
description
"level 3: 99.99%";
}
identity level-4 {
base availability-type;
description
"level 4: 99.9%";
}
identity level-5 {
base availability-type;
description
"level 5: 99%";
}
/* grouping */
grouping service-match-criteria {
description
"A grouping for the slice service match definition.";
container service-match-criteria {
description
"Describes the slice service match criteria.";
list match-criterion {
key "index";
description
"List of the slice service traffic match criteria.";
leaf index {
type uint32;
description
"The entry index.";
}
leaf match-type {
type identityref {
base service-match-type;
}
mandatory true;
description
"Identifies an entry in the list of the slice service
match criteria.";
}
leaf-list value {
type string;
description
"Describes the slice service match criteria, e.g.
IP address, VLAN, etc.";
}
leaf target-connection-group-id {
type leafref {
path
"/ietf-nss:network-slice-services"
+ "/ietf-nss:slice-service"
+ "/ietf-nss:connection-groups/ietf-nss:connection-group"
+ "/ietf-nss:connection-group-id";
}
mandatory true;
description
"Reference to the slice service connection group.";
}
leaf connection-group-sdp-role {
type identityref {
base vpn-common:role;
}
default "vpn-common:any-to-any-role";
description
"Indicates the role in the connection group when
a slice service has multiple multipoint-to-multipoint
connection groups, e.g., hub-spoke.";
}
leaf target-connectivity-construct-id {
type leafref {
path
"/ietf-nss:network-slice-services/slice-service"
+ "/ietf-nss:connection-groups"
+ "/ietf-nss:connection-group[connection-group-id"
+ "=current()/../target-connection-group-id]"
+ "/ietf-nss:connectivity-construct/ietf-nss:cc-id";
}
description
"Reference to a Network Slice connection construct.";
}
}
}
}
grouping service-sles {
description
"Indirectly Measurable Objectives of a slice service.";
leaf-list security {
type identityref {
base service-security-type;
}
description
"The slice service security SLE(s)";
}
leaf isolation {
type identityref {
base service-isolation-type;
}
default "service-isolation-shared";
description
"The slice service isolation SLE requirement.";
}
leaf max-occupancy-level {
type uint8 {
range "1..100";
}
description
"The maximal occupancy level specifies the number of flows to
be admitted.";
}
leaf mtu {
type uint16;
units "bytes";
description
"The MTU specifies the maximum length in octets of data
packets that can be transmitted by the slice service.
The value needs to be less than or equal to the
minimum MTU value of all 'attachment-circuits' in the SDPs.";
}
container steering-constraints {
description
"Container for the policy of steering constraints
applicable to the slice service.";
container path-constraints {
description
"Container for the policy of path constraints
applicable to the slice service.";
}
container service-function {
description
"Container for the policy of service function
applicable to the slice service.";
}
}
}
grouping service-metric-bounds {
description
"Slice service metric bounds grouping.";
container metric-bounds {
description
"Slice service metric bounds container.";
list metric-bound {
key "metric-type";
description
"List of slice service metric bounds.";
leaf metric-type {
type identityref {
base service-slo-metric-type;
}
description
"Identifies an entry in the list of metric type
bounds for the slice service.";
}
leaf metric-unit {
type string;
mandatory true;
description
"The metric unit of the parameter. For example,
s, ms, ns, and so on.";
}
leaf value-description {
type string;
description
"The description of previous value.";
}
leaf bound {
type uint64;
default "0";
description
"The Bound on the slice service connection metric.
A zero indicate an unbounded upper limit for the
specific metric-type.";
}
}
}
}
grouping sdp-peering {
description
"A grouping for the slice service SDP peering.";
container sdp-peering {
description
"Describes SDP peering attributes.";
list protocol {
key "protocol-type";
description
"List of the SDP peering protocol.";
leaf protocol-type {
type identityref {
base peering-protocol-type;
}
description
"Identifies an entry in the list of SDP peering
protocol type.";
}
list attribute {
key "attribute-type";
description
"list of protocol attributes";
leaf attribute-type {
type identityref {
base peering-attribute-type;
}
description
"identifies the attribute type";
}
leaf-list value {
type string;
description
"Describes the value of protocol attribute, e.g.
nexthop address, peer address, etc.";
}
}
}
list opaque {
key "attribute-name";
description
"List of protocol attributes.";
leaf attribute-name {
type string;
description
"The name of the attribute.";
}
leaf-list value {
type string;
description
"The value(s) of the attribute";
}
}
}
}
grouping sdp-attachment-circuits {
description
"Grouping for the SDP attachment circuit definition.";
container attachment-circuits {
description
"List of attachment circuit.";
list attachment-circuit {
key "ac-id";
description
"The IETF Network Slice service SDP attachment circuit
related parameters.";
leaf ac-id {
type string;
description
"Uniquely identifier a attachment circuit.";
}
leaf ac-description {
type string;
description
"The attachment circuit description.";
}
leaf ac-node-id {
type string;
description
"The attachment circuit node ID in the case of
multi-homing.";
}
leaf ac-tp-id {
type string;
description
"The termination port ID of the attachment circuit.";
}
leaf ac-ip-address {
type inet:ip-address;
description
"The IP address of the attachment circuit.";
}
leaf ac-ip-prefix-length {
type uint8;
description
"The subnet prefix length expressed in bits.";
}
leaf ac-qos-policy-name {
type string;
description
"The name of the QoS policy that is applied to the
attachment circuit. The name can reference a QoS
profile that is pre-provisioned on the device.";
}
leaf mtu {
type uint16;
units "bytes";
description
"Maximum size in octets of the slice service data packet
that can traverse a SDP.";
}
container ac-tags {
description
"Container for the attachment circuit tags.";
list ac-tags {
key "ac-tag-type";
description
"The attachment circuit tags list.";
leaf ac-tag-type {
type identityref {
base attachment-circuit-tag-type;
}
description
"The attachment circuit tag type.";
}
leaf-list value {
type string;
description
"The attachment circuit tag value.";
}
}
list ac-tag-opaque {
key "tag-name";
description
"The attachment circuit tag opaque list.";
leaf tag-name {
type string;
description
"The opaque tags name";
}
leaf-list value {
type string;
description
"The opaque tags value";
}
}
}
/* Per ac rate limits */
uses service-match-criteria;
uses sdp-peering;
uses service-rate-limit;
}
}
}
grouping sdp-monitoring-metrics {
description
"Grouping for the SDP monitoring metrics.";
container sdp-monitoring {
config false;
description
"Container for SDP monitoring metrics.";
leaf incoming-utilized-bandwidth {
type te-types:te-bandwidth;
description
"Incoming bandwidth utilization at a SDP.";
}
leaf incoming-bw-utilization {
type decimal64 {
fraction-digits 5;
range "0..100";
}
units "percent";
mandatory true;
description
"To be used to define the bandwidth utilization
as a percentage of the available bandwidth.";
}
leaf outgoing-utilized-bandwidth {
type te-types:te-bandwidth;
description
"Outoing service bandwidth utilization at a SDP.";
}
leaf outgoing-bw-utilization {
type decimal64 {
fraction-digits 5;
range "0..100";
}
units "percent";
mandatory true;
description
"To be used to define the service bandwidth utilization
as a percentage of the available bandwidth.";
}
}
}
grouping connectivity-construct-monitoring-metrics {
description
"Grouping for connectivity construct monitoring metrics.";
uses te-packet-types:one-way-performance-metrics-packet;
uses te-packet-types:two-way-performance-metrics-packet;
}
grouping geolocation-container {
description
"A grouping containing a GPS location.";
container location {
description
"A container containing a GPS location.";
leaf altitude {
type int64;
units "millimeter";
description
"Distance above the sea level.";
}
leaf latitude {
type decimal64 {
fraction-digits 8;
range "-90..90";
}
description
"Relative position north or south on the Earth's surface.";
}
leaf longitude {
type decimal64 {
fraction-digits 8;
range "-180..180";
}
description
"Angular distance east or west on the Earth's surface.";
}
}
// gps-location
}
// geolocation-container
grouping bw-rate-limits {
description
"Bandwidth rate limits grouping.";
reference
"RFC 7640: Traffic Management Benchmarking";
leaf cir {
type uint64;
units "bps";
description
"Committed Information Rate. The maximum number of bits
that a port can receive or send during one-second over an
interface.";
}
leaf cbs {
type uint64;
units "bytes";
description
"Committed Burst Size. CBS controls the bursty nature
of the traffic. Traffic that does not use the configured
CIR accumulates credits until the credits reach the
configured CBS.";
}
leaf eir {
type uint64;
units "bps";
description
"Excess Information Rate, i.e., excess frame delivery
allowed not subject to SLA. The traffic rate can be
limited by EIR.";
}
leaf ebs {
type uint64;
units "bytes";
description
"Excess Burst Size. The bandwidth available for burst
traffic from the EBS is subject to the amount of
bandwidth that is accumulated during periods when
traffic allocated by the EIR policy is not used.";
}
leaf pir {
type uint64;
units "bps";
description
"Peak Information Rate, i.e., maximum frame delivery
allowed. It is equal to or less than sum of CIR and EIR.";
}
leaf pbs {
type uint64;
units "bytes";
description
"Peak Burst Size.";
}
}
grouping service-rate-limit {
description
"The rate limits grouping.";
container incoming-rate-limits {
description
"Container for the asymmetric traffic control.";
uses bw-rate-limits;
}
container outgoing-rate-limits {
description
"The rate-limit imposed on outgoing traffic.";
uses bw-rate-limits;
}
}
grouping sdp {
description
"Slice service SDP related information";
leaf sdp-id {
type string;
description
"Unique identifier for the referred slice service SDP.";
}
leaf sdp-description {
type string;
description
"Give more description of the SDP.";
}
uses geolocation-container;
leaf node-id {
type string;
description
"Uniquely identifies an edge node of the SDP.";
}
leaf sdp-ip {
type inet:ip-address;
description
"The IP address of the SDP.";
}
uses service-match-criteria;
uses sdp-peering;
uses sdp-attachment-circuits;
uses service-rate-limit;
/* Per SDP rate limits */
uses vpn-common:service-status;
uses sdp-monitoring-metrics;
}
//service-sdp
grouping connectivity-construct {
description
"Grouping for slice service connectivity construct.";
list connectivity-construct {
key "cc-id";
description
"List of connectivity constructs.";
leaf cc-id {
type uint32;
description
"The connectivity construct identifier.";
}
choice connectivity-construct-type {
default "p2p";
description
"Choice for connectivity construct type.";
case p2p {
description
"P2P connectivity construct.";
leaf p2p-sender-sdp {
type leafref {
path "../../../../sdps/sdp/sdp-id";
}
description
"Reference to a sender SDP.";
}
leaf p2p-receiver-sdp {
type leafref {
path "../../../../sdps/sdp/sdp-id";
}
description
"Reference to a receiver SDP.";
}
}
case p2mp {
description
"P2MP connectivity construct.";
leaf p2mp-sender-sdp {
type leafref {
path "../../../../sdps/sdp/sdp-id";
}
description
"Reference to a sender SDP.";
}
leaf-list p2mp-receiver-sdp {
type leafref {
path "../../../../sdps/sdp/sdp-id";
}
description
"Reference to a receiver SDP.";
}
}
case a2a {
description
"A2A connectivity construct.";
list a2a-sdp {
key "sdp-id";
description
"List of included A2A SDPs.";
leaf sdp-id {
type leafref {
path "../../../../../sdps/sdp/sdp-id";
}
description
"Reference to a SDP.";
}
uses service-slo-sle-policy;
}
}
}
uses service-slo-sle-policy;
/* Per connectivity construct service-slo-sle-policy
* overrides the per slice service-slo-sle-policy.
*/
container connectivity-construct-monitoring {
config false;
description
"SLO status per connectivity construct.";
uses connectivity-construct-monitoring-metrics;
}
}
}
//connectivity-construct
grouping connection-group {
description
"Grouping for slice service connection group.";
leaf connection-group-id {
type string;
description
"The connection group identifier.";
}
leaf connectivity-type {
type identityref {
base vpn-common:vpn-topology;
}
default "vpn-common:any-to-any";
description
"Connection group connectivity type.";
}
uses service-slo-sle-policy;
uses connectivity-construct;
/* Per connection group service-slo-sle-policy overrides
* the per slice service-slo-sle-policy.
*/
container connection-group-monitoring {
config false;
description
"SLO status per connection group.";
uses connectivity-construct-monitoring-metrics;
}
}
//connection-group
grouping slice-service-template {
description
"Grouping for slice service templates.";
container slo-sle-templates {
description
"Contains a set of slice service templates.";
list slo-sle-template {
key "id";
leaf id {
type string;
description
"Identification of the Service Level Objective (SLO)
and Service Level Expectation (SLE) template to be used.
Local administration meaning.";
}
leaf template-description {
type string;
description
"Description of the SLO and SLE policy template.";
}
description
"List for SLO and SLE template identifiers.";
}
}
}
/* Configuration data nodes */
grouping service-slo-sle-policy {
description
"Slice service policy grouping.";
choice slo-sle-policy {
description
"Choice for SLO and SLE policy template.
Can be standard template or customized template.";
case standard {
description
"Standard SLO template.";
leaf slo-sle-template {
type leafref {
path "/ietf-nss:network-slice-services"
+ "/ietf-nss:slo-sle-templates"
+ "/ietf-nss:slo-sle-template/id";
}
description
"Standard SLO and SLE template to be used.";
}
}
case custom {
description
"Customized SLO and SLE template.";
container service-slo-sle-policy {
description
"Contains the SLO and SLE policy.";
leaf policy-description {
type string;
description
"Description of the SLO and SLE policy.";
}
uses service-metric-bounds;
uses service-sles;
}
}
}
}
container network-slice-services {
description
"Containes a list of IETF network slice services";
uses slice-service-template;
list slice-service {
key "service-id";
description
"A slice service is identified by a service-id.";
leaf service-id {
type string;
description
"A unique slice service identifier.";
}
leaf service-description {
type string;
description
"Textual description of the slice service.";
}
container service-tags {
description
"Container for the list of service tags.";
list tag-type {
key "tag-type";
description
"The service tag list.";
leaf tag-type {
type identityref {
base service-tag-type;
}
description
"Slice service tag type.";
}
leaf-list value {
type string;
description
"The tag value";
}
}
list tag-opaque {
key "tag-name";
description
"The service tag opaquelist.";
leaf tag-name {
type string;
description
"The opaque tag name";
}
leaf-list value {
type string;
description
"The opaque tag value";
}
}
}
uses service-slo-sle-policy;
uses vpn-common:service-status;
container sdps {
description
"Slice service SDPs.";
list sdp {
key "sdp-id";
uses sdp;
description
"List of SDPs in this slice service.";
}
}
container connection-groups {
description
"Contains connections group.";
list connection-group {
key "connection-group-id";
description
"List of connection groups.";
uses connection-group;
}
}
}
//ietf-network-slice-service list
}
}
deepdiff==5.8.*
#deepdiff==5.8.*
......@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import grpc, logging, deepdiff
import grpc, logging #, deepdiff
from common.proto.context_pb2 import (
Empty, Service, ServiceId, ServiceStatusEnum, ServiceTypeEnum, Slice, SliceId, SliceStatusEnum)
from common.proto.slice_pb2_grpc import SliceServiceServicer
......@@ -52,11 +52,11 @@ class SliceServiceServicerImpl(SliceServiceServicer):
slice_request = Slice()
slice_request.CopyFrom(_slice)
LOGGER.info('json_current_slice = {:s}'.format(str(json_current_slice)))
json_updated_slice = grpc_message_to_json(request)
LOGGER.info('json_updated_slice = {:s}'.format(str(json_updated_slice)))
changes = deepdiff.DeepDiff(json_current_slice, json_updated_slice)
LOGGER.info('changes = {:s}'.format(str(changes)))
#LOGGER.info('json_current_slice = {:s}'.format(str(json_current_slice)))
#json_updated_slice = grpc_message_to_json(request)
#LOGGER.info('json_updated_slice = {:s}'.format(str(json_updated_slice)))
#changes = deepdiff.DeepDiff(json_current_slice, json_updated_slice)
#LOGGER.info('changes = {:s}'.format(str(changes)))
domains = set()
for slice_endpoint_id in request.slice_endpoint_ids:
......@@ -146,7 +146,7 @@ class SliceServiceServicerImpl(SliceServiceServicer):
def DeleteSlice(self, request : SliceId, context : grpc.ServicerContext) -> Empty:
context_client = ContextClient()
try:
_slice = context_client.GetSlice(request.slice_id)
_slice = context_client.GetSlice(request)
except:
return Empty()
......@@ -172,10 +172,13 @@ class SliceServiceServicerImpl(SliceServiceServicer):
service_client = ServiceClient()
for service_id in _slice.slice_service_ids:
try:
service_client.DeleteService(service_id)
except:
pass
current_slice = Slice()
current_slice.slice_id.CopyFrom(_slice.slice_id)
slice_service_id = current_slice.slice_service_ids.add()
slice_service_id.CopyFrom(service_id)
context_client.UnsetSlice(current_slice)
service_client.DeleteService(service_id)
context_client.RemoveSlice(request.slice_id)
context_client.RemoveSlice(request)
return Empty()
......@@ -29,7 +29,7 @@ def main():
global LOGGER # pylint: disable=global-statement
log_level = get_log_level()
logging.basicConfig(level=log_level)
logging.basicConfig(level=log_level, format="[%(asctime)s] %(levelname)s:%(name)s:%(message)s")
LOGGER = logging.getLogger(__name__)
wait_for_environment_variables([
......
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