Commit fd8fe619 authored by Waleed Akbar's avatar Waleed Akbar
Browse files

refactor: Pluggable component

- Removed DSCM form pluggable ServiceEnumName
- Other minor changes
parent 427ed4e3
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
// Copyright 2022-2025 ETSI 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.


syntax = "proto3";

package tfs.pluggables.v0;
package pluggables;

import "context.proto";

@@ -13,7 +28,6 @@ service PluggablesService {
}



message PluggableId {
  context.DeviceId device = 1;
  int32 pluggable_index   = 2;  // physical slot number in the device
+2 −2
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ class ServiceNameEnum(Enum):
    ANALYTICSBACKEND       = 'analytics-backend'
    QOSPROFILE             = 'qos-profile'
    OSMCLIENT              = 'osm-client'
    DSCMPLUGGABLE          = 'dscm-pluggable'
    PLUGGABLES              = 'dscm-pluggable'

    # Used for test and debugging only
    DLT_GATEWAY    = 'dltgateway'
@@ -118,7 +118,7 @@ DEFAULT_SERVICE_GRPC_PORTS = {
    ServiceNameEnum.ANALYTICSBACKEND       .value : 30090,
    ServiceNameEnum.AUTOMATION             .value : 30200,
    ServiceNameEnum.OSMCLIENT              .value : 30210,
    ServiceNameEnum.DSCMPLUGGABLE          .value : 30220,
    ServiceNameEnum.PLUGGABLES             .value : 30220,

    # Used for test and debugging only
    ServiceNameEnum.DLT_GATEWAY   .value : 50051,
+13 −13
Original line number Diff line number Diff line
@@ -98,19 +98,19 @@ if LOAD_ALL_DEVICE_DRIVERS:
            }
        ]))

# if LOAD_ALL_DEVICE_DRIVERS:
#     from .gnmi_openconfig.GnmiOpenConfigDriver import GnmiOpenConfigDriver # pylint: disable=wrong-import-position
#     DRIVERS.append(
#         (GnmiOpenConfigDriver, [
#             {
#                 # Real Packet Router, specifying gNMI OpenConfig Driver => use GnmiOpenConfigDriver
#                 FilterFieldEnum.DEVICE_TYPE: [
#                     DeviceTypeEnum.PACKET_POP,
#                     DeviceTypeEnum.PACKET_ROUTER,
#                 ],
#                 FilterFieldEnum.DRIVER     : DeviceDriverEnum.DEVICEDRIVER_GNMI_OPENCONFIG,
#             }
#         ]))
if LOAD_ALL_DEVICE_DRIVERS:
    from .gnmi_openconfig.GnmiOpenConfigDriver import GnmiOpenConfigDriver # pylint: disable=wrong-import-position
    DRIVERS.append(
        (GnmiOpenConfigDriver, [
            {
                # Real Packet Router, specifying gNMI OpenConfig Driver => use GnmiOpenConfigDriver
                FilterFieldEnum.DEVICE_TYPE: [
                    DeviceTypeEnum.PACKET_POP,
                    DeviceTypeEnum.PACKET_ROUTER,
                ],
                FilterFieldEnum.DRIVER     : DeviceDriverEnum.DEVICEDRIVER_GNMI_OPENCONFIG,
            }
        ]))

if LOAD_ALL_DEVICE_DRIVERS:
    from .gnmi_nokia_srlinux.GnmiNokiaSrLinuxDriver import GnmiNokiaSrLinuxDriver # pylint: disable=wrong-import-position
+19 −19
Original line number Diff line number Diff line
# DSCM (Digital Subcarrier Multipelxed) Service
# Pluggables Service (Digital Subcarrier Multiplexed)

## Overview

The DSCM service provides gRPC-based management for optical pluggables and their digital subcarrier groups. It enables configuration and monitoring of coherent optical transceivers with support for multi-carrier operation.
The Pluggables service provides gRPC-based management for optical pluggables and their digital subcarrier groups. It enables configuration and monitoring of coherent optical transceivers with support for multi-carrier operation.

## Key Concepts

@@ -47,11 +47,11 @@ Control the level of detail in responses:
### 1. Creating a Pluggable Without Configuration

```python
from dscm.client.DscmPluggableClient import DscmPluggableClient
from dscm.tests.testmessages import create_pluggable_request
from pluggables.client.PluggablesClient import PluggablesClient
from pluggables.tests.testmessages import create_pluggable_request

# Create client
client = DscmPluggableClient()
client = PluggablesClient()

# Create pluggable request (auto-assign index)
request = create_pluggable_request(
@@ -70,7 +70,7 @@ client.close()
### 2. Creating a Pluggable With Initial Configuration

```python
from dscm.tests.testmessages import create_pluggable_request
from pluggables.tests.testmessages import create_pluggable_request

# Create pluggable with optical channel configuration
request = create_pluggable_request(
@@ -91,8 +91,8 @@ assert dsc_group.group_capacity_gbps == 400.0
### 3. Listing Pluggables with View Filtering

```python
from common.proto.dscm_pluggable_pb2 import View
from dscm.tests.testmessages import create_list_pluggables_request
from common.proto.pluggables_pb2 import View
from pluggables.tests.testmessages import create_list_pluggables_request

# List only configuration (no state data)
request = create_list_pluggables_request(
@@ -108,7 +108,7 @@ for pluggable in response.pluggables:
### 4. Getting a Specific Pluggable

```python
from dscm.tests.testmessages import create_get_pluggable_request
from pluggables.tests.testmessages import create_get_pluggable_request

# Get full pluggable details
request = create_get_pluggable_request(
@@ -126,7 +126,7 @@ print(f"DSC Groups: {len(pluggable.config.dsc_groups)}")
### 5. Configuring a Pluggable

```python
from dscm.tests.testmessages import create_configure_pluggable_request
from pluggables.tests.testmessages import create_configure_pluggable_request

# Apply full configuration (reconfigure optical channels)
request = create_configure_pluggable_request(
@@ -148,7 +148,7 @@ print(f"Configured {len(pluggable.config.dsc_groups[0].subcarriers)} subcarriers
### 6. Deleting a Pluggable

```python
from dscm.tests.testmessages import create_delete_pluggable_request
from pluggables.tests.testmessages import create_delete_pluggable_request

# Delete pluggable from management
request = create_delete_pluggable_request(
@@ -165,10 +165,10 @@ print("Pluggable deleted successfully")
### Complete Configuration Example

```python
from common.proto import dscm_pluggable_pb2
from common.proto import pluggables_pb2

# Create configuration request
request = dscm_pluggable_pb2.ConfigurePluggableRequest()
request = pluggables_pb2.ConfigurePluggableRequest()

# Set pluggable ID
request.config.id.device.device_uuid.uuid = "550e8400-e29b-41d4-a716-446655440000"
@@ -199,15 +199,15 @@ subcarrier2 = dsc_group.subcarriers.add()
# ... (similar configuration for second subcarrier)

# Set view level and timeout
request.view_level = dscm_pluggable_pb2.VIEW_FULL
request.view_level = pluggables_pb2.VIEW_FULL
request.apply_timeout_seconds = 30
```

## API Reference

For complete API documentation, see:
- Protocol Buffer definitions: `/home/ubuntu/tfs-ctrl/proto/dscm_pluggable.proto`
- Client implementation: `/home/ubuntu/tfs-ctrl/src/dscm/client/DscmPluggableClient.py`
- Service implementation: `/home/ubuntu/tfs-ctrl/src/dscm/service/DscmPluggableServiceServicerImpl.py`
- Test examples: `/home/ubuntu/tfs-ctrl/src/dscm/tests/test_DscmPluggables.py`
- Message helpers: `/home/ubuntu/tfs-ctrl/src/dscm/tests/testmessages.py`
- Protocol Buffer definitions: `proto/pluggables.proto`
- Client implementation: `src/pluggables/client/PluggablesClient.py`
- Service implementation: `src/pluggables/service/PluggablesServiceServicerImpl.py`
- Test examples: `src/pluggables/tests/test_Pluggables.py`
- Message helpers: `src/pluggables/tests/testmessages.py`
+2 −2
Original line number Diff line number Diff line
@@ -32,8 +32,8 @@ RETRY_DECORATOR = retry(max_retries=MAX_RETRIES, delay_function=DELAY_FUNCTION,

class PluggablesClient:
    def __init__(self, host=None, port=None):
        if not host: host = get_service_host(ServiceNameEnum.DSCMPLUGGABLE) 
        if not port: port = get_service_port_grpc(ServiceNameEnum.DSCMPLUGGABLE) 
        if not host: host = get_service_host(ServiceNameEnum.PLUGGABLES) 
        if not port: port = get_service_port_grpc(ServiceNameEnum.PLUGGABLES) 
        self.endpoint     = '{:s}:{:s}'.format(str(host), str(port))
        LOGGER.debug('Creating channel to {:s}...'.format(str(self.endpoint)))

Loading