
- Add new reosurce field in ethernet switch for RSD v2_3 Change-Id: I2e535254715314bb03188c58100a71e36e6f5031
93 lines
3.0 KiB
Python
93 lines
3.0 KiB
Python
# Copyright 2018 99cloud, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# 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.
|
|
|
|
import logging
|
|
|
|
from rsd_lib.resources.v2_1.ethernet_switch import ethernet_switch\
|
|
as v2_1_ethernet_switch
|
|
from sushy.resources import base
|
|
|
|
from rsd_lib import utils as rsd_lib_utils
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
class ClassToPriorityMappingField(base.ListField):
|
|
priority = base.Field('Priority', adapter=int)
|
|
|
|
traffic_class = base.Field('TrafficClass', adapter=int)
|
|
|
|
|
|
class PriorityFlowControlField(base.CompositeField):
|
|
enabled = base.Field('Enabled', adapter=bool)
|
|
|
|
lossless_priorities = base.Field('LosslessPriorities', adapter=list)
|
|
|
|
|
|
class PriorityToClassMappingField(base.ListField):
|
|
priority = base.Field('Priority', adapter=int)
|
|
|
|
traffic_class = base.Field('TrafficClass', adapter=int)
|
|
|
|
|
|
class TrafficClassficationField(base.ListField):
|
|
port = base.Field('Port', adapter=int)
|
|
|
|
protocol = base.Field('Protocol')
|
|
|
|
traffic_class = base.Field('TrafficClass', adapter=int)
|
|
|
|
|
|
class TransmissionSelectionField(base.ListField):
|
|
bandwidth_percent = base.Field('BandwidthPercent', adapter=int)
|
|
|
|
traffic_class = base.Field('TrafficClass', adapter=int)
|
|
|
|
|
|
class EthernetSwitch(v2_1_ethernet_switch.EthernetSwitch):
|
|
class_to_priority_mapping = ClassToPriorityMappingField(
|
|
'ClassToPriorityMapping')
|
|
"""The ethernet switch class to priority mapping"""
|
|
|
|
dcbx_enabled = base.Field('DCBXEnabled', adapter=bool)
|
|
"""The boolean indicate this dcbx is enabled or not"""
|
|
|
|
ets_enabled = base.Field('ETSEnabled', adapter=bool)
|
|
"""The boolean indicate this etse is enabled or not"""
|
|
|
|
lldp_enabled = base.Field('LLDPEnabled', adapter=bool)
|
|
"""The boolean indicate this lldp is enabled or not"""
|
|
|
|
max_acl_number = base.Field('MaxACLNumber')
|
|
"""The ethernet switch max acl number"""
|
|
|
|
metrics = base.Field('Metrics', default=(),
|
|
adapter=rsd_lib_utils.get_resource_identity)
|
|
"""The ethernet switch metrics"""
|
|
|
|
priority_flow_control = PriorityFlowControlField('PriorityFlowControl')
|
|
"""The ethernet switch priority flow control"""
|
|
|
|
priority_to_class_mapping = PriorityToClassMappingField(
|
|
'PriorityToClassMapping')
|
|
"""The ethernet switch priority to class mapping"""
|
|
|
|
traffic_classification = TrafficClassficationField('TrafficClassification')
|
|
"""The ethernet switch traffic classification"""
|
|
|
|
transmission_selection = TransmissionSelectionField(
|
|
'TransmissionSelection')
|
|
"""The ethernet switch transmission selection"""
|