Commit 1a2ad3f9 authored by Manuel Angel Jimenez Quesada's avatar Manuel Angel Jimenez Quesada
Browse files

Code cleanup

parent 492e11c6
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -497,7 +497,7 @@ message EndPointId {
message EndPoint {
message EndPoint {
  EndPointId endpoint_id = 1;
  EndPointId endpoint_id = 1;
  string name = 2;
  string name = 2;
  string endpoint_type = 3; // == 'smartnics'
  string endpoint_type = 3;
  repeated kpi_sample_types.KpiSampleType kpi_sample_types = 4;
  repeated kpi_sample_types.KpiSampleType kpi_sample_types = 4;
  Location endpoint_location = 5;
  Location endpoint_location = 5;
  map<string, google.protobuf.Any> capabilities = 6;
  map<string, google.protobuf.Any> capabilities = 6;

proto/nfv_client.proto

deleted100644 → 0
+0 −51
Original line number Original line Diff line number Diff line
// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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.

syntax = "proto3";
package nfv_client;

import "context.proto";

message Nsd {
	string nsd_name = 1;
  string config_params=2;
}

message Ns {
	string ns_id=1;
	string ns_name=2;
	string nsd_name=3;
  string vim_account=4;
  string config_params=5;
  string status = 6;
  string status_message = 7;
}

message NsList {
  repeated Ns ns = 1;
}

message NsdList {
  repeated Nsd nsd = 1;
}

service nfv_client {
    rpc GetNsList               (context.Empty) returns (NsList) {}
    rpc GetNsdList               (context.Empty) returns (NsdList) {}
    rpc CreateNs                (Ns) returns (Ns) {} 
    rpc UpdateNs                (Ns) returns (Ns) {}
    rpc DeleteNs                (Ns) returns (context.Empty) {}
}

	

proto/nos_client.proto

deleted100644 → 0
+0 −33
Original line number Original line Diff line number Diff line
// Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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.

syntax = "proto3";
package nos_client;

message NOS_SW {
	string ztp_device_sw_url = 1;
  bytes ztp_device_sw_file = 2;
}

message Config_Script {
  string config_script_url = 1;
  bytes config_script_file = 2;
}

service nos_client {
    rpc GetNOSFile            (NOS_SW) returns (NOS_SW) {}
    rpc GetConfigScriptFile   (Config_Script) returns (Config_Script) {}
}

	
+2 −4
Original line number Original line Diff line number Diff line
@@ -12,13 +12,12 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.


import copy, logging
import copy
from typing import Dict, List, Optional, Tuple
from typing import Dict, List, Optional, Tuple
from common.DeviceTypes import DeviceTypeEnum
from common.DeviceTypes import DeviceTypeEnum
from common.proto.context_pb2 import DeviceDriverEnum, DeviceOperationalStatusEnum
from common.proto.context_pb2 import DeviceDriverEnum, DeviceOperationalStatusEnum
from common.tools.object_factory.ConfigRule import json_config_rule_set
from common.tools.object_factory.ConfigRule import json_config_rule_set


LOGGER = logging.getLogger(__name__)
DEVICE_DISABLED = DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_DISABLED
DEVICE_DISABLED = DeviceOperationalStatusEnum.DEVICEOPERATIONALSTATUS_DISABLED


DEVICE_EMUDC_TYPE   = DeviceTypeEnum.EMULATED_DATACENTER.value
DEVICE_EMUDC_TYPE   = DeviceTypeEnum.EMULATED_DATACENTER.value
@@ -53,7 +52,6 @@ DEVICE_IETF_ACTN_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_IETF_ACTN]
DEVICE_SMARTNIC_TYPE = DeviceTypeEnum.SMARTNIC.value
DEVICE_SMARTNIC_TYPE = DeviceTypeEnum.SMARTNIC.value
DEVICE_SMARTNIC_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_SMARTNIC]
DEVICE_SMARTNIC_DRIVERS = [DeviceDriverEnum.DEVICEDRIVER_SMARTNIC]



def json_device_id(device_uuid : str):
def json_device_id(device_uuid : str):
    return {'device_uuid': {'uuid': device_uuid}}
    return {'device_uuid': {'uuid': device_uuid}}


@@ -63,13 +61,13 @@ def json_device(
    ):
    ):
    result = {
    result = {
        'device_id'                : json_device_id(device_uuid),
        'device_id'                : json_device_id(device_uuid),
        'name'                     : name,
        'device_type'              : device_type,
        'device_type'              : device_type,
        'device_config'            : {'config_rules': copy.deepcopy(config_rules)},
        'device_config'            : {'config_rules': copy.deepcopy(config_rules)},
        'device_operational_status': status,
        'device_operational_status': status,
        'device_drivers'           : copy.deepcopy(drivers),
        'device_drivers'           : copy.deepcopy(drivers),
        'device_endpoints'         : copy.deepcopy(endpoints),
        'device_endpoints'         : copy.deepcopy(endpoints),
    }
    }
    if name is not None: result['name'] = name
    return result
    return result


def json_device_emulated_packet_router_disabled(
def json_device_emulated_packet_router_disabled(
+1 −1
Original line number Original line Diff line number Diff line
@@ -167,7 +167,7 @@ if LOAD_ALL_DEVICE_DRIVERS:
    DRIVERS.append(
    DRIVERS.append(
        (SmartnicDriver, [
        (SmartnicDriver, [
            {
            {
                # Real P4 Switch, specifying P4 Driver => use P4Driver
                # Real SmartNics device => use SmartNicsDriver
                FilterFieldEnum.DEVICE_TYPE: DeviceTypeEnum.SMARTNIC,
                FilterFieldEnum.DEVICE_TYPE: DeviceTypeEnum.SMARTNIC,
                FilterFieldEnum.DRIVER     : DeviceDriverEnum.DEVICEDRIVER_SMARTNIC,
                FilterFieldEnum.DRIVER     : DeviceDriverEnum.DEVICEDRIVER_SMARTNIC,
            }
            }
Loading