VOL-172: Support configuration of traffic descriptor profile for upstream BW allocation to ONU
* As an operator, I should be able to configure traffic descriptor profiles for upstream BW configuration.
* As an operator, I should be able to retrieve the configured traffic descriptor profiles.
Additional Notes:
* xPON Handler and xPON Agent should be able to handle the traffic descriptor configuration.
* This story does not have impact on adapters until the traffic descriptor is referenced by a TCONT
* The traffic descriptor profiles should be saved to the database(in memory until config/restore feature is ready).
* The impact to HA-proxy for load-balancing & distributing of workload is still TBD. As of now, it can be assumed that profiles are available to all VOLTHA instances.
VOL-173: Support configuration of TCONTs as per WT-385 and auto-allocation of alloc-ids
* As an operator, I should be able to provision a TCONT for the ONU with an existing traffic descriptor profile
* As an operator, I should be able to retrieve the provisioned TCONT
* As an operator, I should be able to change the traffic descriptor profile for a TCONT
Additional Notes:
* alloc-ids should be allocated for the TCONT
* generic IAdapter interface to be provided that will be used by OLT and ONU adapters for TCONT/alloc-id/BW configuration
* In the best interest of schedules/timing, in the first step(e.g. POC-3 & trial), assume the queueing model to be supported (to be detailed) (i.e. no configuration of queueing model)
* The concerned ONU should receive upstream grants upon provisioning of TCONT for the ONU
VOL-174: Support configuration of GEMs as per WT-385 and auto-allocation of gemport-ids
* As an operator, I should be able to provision a GEMPORT object for the ONU and assign to a UNI
* As an operator, I should be able to retrieve the provisioned GEMPORT
Additional Notes:
* gemport-ids should be auto-allocated for the GEMPORT object
* generic IAdapter interface to be provided that will be used by OLT and ONU adapters for GEM port configuration
* In the best interest of schedules/timing, in the first step(e.g. POC-3 & trial), assume the queueing model to be supported (to be detailed) (i.e. no configuration of queueing model)
* The concerned OLT and ONU should be configured with the allocated gemport-ids
Change-Id: I451cd7c0eda57c7b9fa1d65d02c749ff2bf0db4b
diff --git a/cli/main.py b/cli/main.py
index 8e51851..6060435 100755
--- a/cli/main.py
+++ b/cli/main.py
@@ -262,9 +262,9 @@
try:
res = stub.GetDevice(voltha_pb2.ID(id=device_id))
except Exception:
- self.poutput(self.colorize('Error: ', 'red') + \
- 'No device id ' + self.colorize(device_id, 'blue') + \
- ' is found')
+ self.poutput(
+ self.colorize('Error: ', 'red') + 'No device id ' +
+ self.colorize(device_id, 'blue') + ' is found')
return
sub = XponCli(self.get_channel, device_id)
sub.cmdloop()
diff --git a/cli/xpon.py b/cli/xpon.py
index dbd7f97..7e3d8c2 100644
--- a/cli/xpon.py
+++ b/cli/xpon.py
@@ -32,10 +32,16 @@
AllChannelpartitionConfig, ChannelpartitionConfig, \
AllChannelterminationConfig, ChannelterminationConfig, \
AllOntaniConfig, OntaniConfig, AllVOntaniConfig , \
- VOntaniConfig, AllVEnetConfig , VEnetConfig
+ VOntaniConfig, AllVEnetConfig , VEnetConfig, \
+ AllTrafficDescriptorProfileData, AllTcontsConfigData, AllGemportsConfigData
+from voltha.protos.bbf_fiber_traffic_descriptor_profile_body_pb2 import \
+ TrafficDescriptorProfileData
+from voltha.protos.bbf_fiber_tcont_body_pb2 import TcontsConfigData
+from voltha.protos.bbf_fiber_gemport_body_pb2 import GemportsConfigData
_ = third_party
-from voltha.protos import voltha_pb2, bbf_fiber_types_pb2, ietf_interfaces_pb2
+from voltha.protos import voltha_pb2, bbf_fiber_types_pb2, \
+ ietf_interfaces_pb2, bbf_fiber_traffic_descriptor_profile_body_pb2
import sys
from google.protobuf.json_format import MessageToDict
@@ -58,28 +64,54 @@
def get_ref_interfaces(self, all_interfaces, ref_interfaces):
interface_list = []
+ interface_name_list = []
if not all_interfaces:
return interface_list
if isinstance(all_interfaces[0], (ChannelgroupConfig,
ChannelpartitionConfig,
- ChannelpairConfig, OntaniConfig)):
+ ChannelpairConfig, OntaniConfig,
+ TrafficDescriptorProfileData)):
for interface in all_interfaces:
- if interface.name in ref_interfaces:
+ if interface.name in ref_interfaces and \
+ interface.name not in interface_name_list:
+ interface_name_list.append(interface.name)
interface_list.append(interface)
elif isinstance(all_interfaces[0], VOntaniConfig):
for interface in all_interfaces:
- if interface.data.parent_ref in ref_interfaces:
+ if interface.data.parent_ref in ref_interfaces and \
+ interface.name not in interface_name_list:
+ interface_name_list.append(interface.name)
interface_list.append(interface)
elif isinstance(all_interfaces[0], VEnetConfig):
for interface in all_interfaces:
- if interface.data.v_ontani_ref in ref_interfaces:
+ if interface.data.v_ontani_ref in ref_interfaces and \
+ interface.name not in interface_name_list:
+ interface_name_list.append(interface.name)
+ interface_list.append(interface)
+ elif isinstance(all_interfaces[0], TcontsConfigData):
+ for interface in all_interfaces:
+ if interface.interface_reference in ref_interfaces and \
+ interface.name not in interface_name_list:
+ interface_name_list.append(interface.name)
+ interface_list.append(interface)
+ elif isinstance(all_interfaces[0], GemportsConfigData):
+ for interface in all_interfaces:
+ if interface.itf_ref in ref_interfaces and \
+ interface.name not in interface_name_list:
+ interface_name_list.append(interface.name)
interface_list.append(interface)
return interface_list
def get_interface_based_on_device(self):
- stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
- channel_terminations = stub.GetAllChannelterminationConfig(
- voltha_pb2.ID(id=self.device_id)).channeltermination_config
+ stub = voltha_pb2.VolthaGlobalServiceStub(self.get_channel())
+ try:
+ channel_terminations = stub.GetAllChannelterminationConfig(
+ voltha_pb2.ID(id=self.device_id)).channeltermination_config
+ except Exception:
+ self.poutput(
+ self.colorize('Error: ', 'red') + 'No device id ' \
+ + self.colorize(device_id, 'blue') + ' is found')
+ return
channel_pairs = self.get_ref_interfaces(
stub.GetAllChannelpairConfig(Empty()).channelpair_config,
dict((dt.data.channelpair_ref, dt) for dt in channel_terminations))
@@ -98,8 +130,19 @@
venets = self.get_ref_interfaces(
stub.GetAllVEnetConfig(Empty()).v_enet_config,
dict((dt.name, dt) for dt in vont_anis))
+ tconts = self.get_ref_interfaces(
+ stub.GetAllTcontsConfigData(Empty()).tconts_config,
+ dict((dt.name, dt) for dt in vont_anis))
+ traffic_descriptor_profiles = self.get_ref_interfaces(
+ stub.GetAllTrafficDescriptorProfileData(Empty()).
+ traffic_descriptor_profiles,
+ dict((dt.traffic_descriptor_profile_ref, dt) for dt in tconts))
+ gemports = self.get_ref_interfaces(
+ stub.GetAllGemportsConfigData(Empty()).gemports_config,
+ dict((dt.name, dt) for dt in venets))
return channel_groups, channel_partitions, channel_pairs,\
- channel_terminations, vont_anis, ont_anis, venets
+ channel_terminations, vont_anis, ont_anis, venets, \
+ traffic_descriptor_profiles, tconts, gemports
do_exit = Cmd.do_quit
@@ -109,40 +152,50 @@
def do_show(self, line):
"""Show detailed information of each interface based on device ID
or all interfaces"""
- stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
+ stub = voltha_pb2.VolthaGlobalServiceStub(self.get_channel())
device_id = self.device_id
if line.strip():
- device_id = line.strip()
- if device_id:
- cg, cpart, cp, ct, vont, ont, venet = \
+ self.device_id = line.strip()
+ if self.device_id:
+ cg, cpart, cp, ct, vont, ont, venet, tdp, tcont, gemport = \
self.get_interface_based_on_device()
- print_pb_list_as_table("Channel Groups for device ID = {}:"
- .format(device_id), cg, {}, self.poutput)
+ print_pb_list_as_table("Channel Groups for device ID = {}:".format(
+ self.device_id), cg, {}, self.poutput)
print_pb_list_as_table("Channel Partitions for device ID = {}:"
- .format(device_id),cpart, {}, self.poutput)
- print_pb_list_as_table("Channel Pairs: for device ID = {}:"
- .format(device_id), cp, {}, self.poutput)
+ .format(self.device_id),cpart, {},
+ self.poutput)
+ print_pb_list_as_table("Channel Pairs: for device ID = {}:".format(
+ self.device_id), cp, {}, self.poutput)
print_pb_list_as_table("Channel Terminations for device ID = {}:"
- .format(device_id), ct, {}, self.poutput)
- print_pb_list_as_table("VOnt Anis for device ID = {}:"
- .format(device_id), vont, {}, self.poutput)
- print_pb_list_as_table("Ont Anis for device ID = {}:"
- .format(device_id), ont, {}, self.poutput)
- print_pb_list_as_table("VEnets for device ID = {}:"
- .format(device_id), venet, {}, self.poutput)
+ .format(self.device_id), ct, {},
+ self.poutput)
+ print_pb_list_as_table("VOnt Anis for device ID = {}:".format(
+ self.device_id), vont, {}, self.poutput)
+ print_pb_list_as_table("Ont Anis for device ID = {}:".format(
+ self.device_id), ont, {}, self.poutput)
+ print_pb_list_as_table("VEnets for device ID = {}:".format(
+ self.device_id), venet, {}, self.poutput)
+ print_pb_list_as_table(
+ "Traffic Descriptor Profiles for device ID = {}:".format(
+ self.device_id), tdp, {}, self.poutput)
+ print_pb_list_as_table("TConts for device ID = {}:".format(
+ self.device_id), tcont, {}, self.poutput)
+ print_pb_list_as_table("Gem Ports for device ID = {}:".format(
+ self.device_id), gemport, {}, self.poutput)
+ self.device_id = device_id
else:
interface = stub.GetAllChannelgroupConfig(Empty())
print_pb_list_as_table("Channel Groups:",
- interface.channelgroup_config,
- {}, self.poutput)
+ interface.channelgroup_config, {},
+ self.poutput)
interface = stub.GetAllChannelpartitionConfig(Empty())
print_pb_list_as_table("Channel Partitions:",
- interface.channelpartition_config,
- {}, self.poutput)
+ interface.channelpartition_config, {},
+ self.poutput)
interface = stub.GetAllChannelpairConfig(Empty())
print_pb_list_as_table("Channel Pairs:",
- interface.channelpair_config,
- {}, self.poutput)
+ interface.channelpair_config, {},
+ self.poutput)
devices = stub.ListDevices(Empty())
for d in devices.items:
interface = stub.GetAllChannelterminationConfig(
@@ -152,17 +205,26 @@
.format(d.id), interface.channeltermination_config,
{}, self.poutput)
interface = stub.GetAllVOntaniConfig(Empty())
- print_pb_list_as_table("VOnt Anis:",
- interface.v_ontani_config,
- {}, self.poutput)
+ print_pb_list_as_table("VOnt Anis:", interface.v_ontani_config, {},
+ self.poutput)
interface = stub.GetAllOntaniConfig(Empty())
- print_pb_list_as_table("Ont Anis:",
- interface.ontani_config,
- {}, self.poutput)
+ print_pb_list_as_table("Ont Anis:", interface.ontani_config, {},
+ self.poutput)
interface = stub.GetAllVEnetConfig(Empty())
- print_pb_list_as_table("VEnets:",
- interface.v_enet_config,
- {}, self.poutput)
+ print_pb_list_as_table("VEnets:", interface.v_enet_config, {},
+ self.poutput)
+ traffic_descriptor = \
+ stub.GetAllTrafficDescriptorProfileData(Empty())
+ print_pb_list_as_table(
+ "Traffic Descriptor Profiles:",
+ traffic_descriptor.traffic_descriptor_profiles, {},
+ self.poutput)
+ tconts = stub.GetAllTcontsConfigData(Empty())
+ print_pb_list_as_table("TConts:", tconts.tconts_config, {},
+ self.poutput)
+ gemports = stub.GetAllGemportsConfigData(Empty())
+ print_pb_list_as_table("Gem Ports:", gemports.gemports_config, {},
+ self.poutput)
def help_channel_group(self):
self.poutput(
@@ -192,7 +254,8 @@
Example:
-channel_group create -n cg-1 -a up -p 100 -s 000000 -r raman_none
+channel_group create -n "Manhattan" -d "Channel Group for Manhattan" -a up
+ -p 100 -s 000000 -r raman_none
'''
)
@@ -224,16 +287,16 @@
update -flags <attributes>, delete -n <name>"""
# Ensure that a valid sub-command was provided
if line.strip() not in {"get", "create", "update", "delete"}:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(line.strip(), 'blue'),
- 'bold') + ' is not recognized')
+ self.poutput(self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(line.strip(), 'blue'),
+ 'bold') + ' is not recognized')
return
- stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
+ stub = voltha_pb2.VolthaGlobalServiceStub(self.get_channel())
if line.strip() == "get":
if self.device_id:
- cg, cpart, cp, ct, vont, ont, venet = \
+ cg, cpart, cp, ct, vont, ont, venet, tdp, tcont, gemport = \
self.get_interface_based_on_device()
print_pb_list_as_table("Channel Groups for device ID = {}:"
.format(self.device_id),
@@ -244,26 +307,25 @@
interface.channelgroup_config,
{}, self.poutput)
return
- interface_instance = ChannelgroupConfig(name = opts.name)
- interface_instance.interface.name = opts.name
- if opts.description:
- interface_instance.interface.description = opts.description
- interface_instance.interface.type = "channelgroup"
- if opts.enabled:
- if opts.enabled == "up":
- interface_instance.interface.enabled = True
- elif opts.enabled == "down":
- interface_instance.interface.enabled = False
- else:
- self.poutput(
- self.colorize('Error: ', 'red') + self.colorize(
- self.colorize(
- 'Invalid admin state parameter for channel group',
- 'blue'), 'bold'))
- return
- if opts.link_up_down_trap_enable:
- types = ["trap_disabled", "trap_enabled"]
- try:
+ try:
+ interface_instance = ChannelgroupConfig(name = opts.name)
+ interface_instance.interface.name = opts.name
+ if opts.description:
+ interface_instance.interface.description = opts.description
+ interface_instance.interface.type = "channelgroup"
+ if opts.enabled:
+ if opts.enabled == "up":
+ interface_instance.interface.enabled = True
+ elif opts.enabled == "down":
+ interface_instance.interface.enabled = False
+ else:
+ self.poutput(
+ self.colorize('Error: ', 'red') + self.colorize(
+ self.colorize('Invalid admin state parameter for \
+ channel group', 'blue'), 'bold'))
+ return
+ if opts.link_up_down_trap_enable:
+ types = ["trap_disabled", "trap_enabled"]
assert opts.link_up_down_trap_enable in types, \
'Invalid Enum value for Channel Group link up down trap \
enable type \'{}\''.format(opts.link_up_down_trap_enable)
@@ -271,38 +333,31 @@
ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
values_by_name[opts.link_up_down_trap_enable.upper()]\
.number
- except AssertionError, e:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(e.message, 'blue'),
- 'bold'))
- return
-
- if opts.polling_period:
- interface_instance.data.polling_period = opts.polling_period
- if opts.raman_mitigation:
- raman_mitigations = ["raman_none", "raman_miller", "raman_8b10b"]
- try:
+ if opts.polling_period:
+ interface_instance.data.polling_period = opts.polling_period
+ if opts.raman_mitigation:
+ raman_mitigations = ["raman_none", "raman_miller",
+ "raman_8b10b"]
assert opts.raman_mitigation in raman_mitigations, \
'Invalid Enum value for Channel Group raman mitigation\
\'{}\''.format(opts.raman_mitigation)
interface_instance.data.raman_mitigation = \
bbf_fiber_types_pb2._RAMANMITIGATIONTYPE.\
values_by_name[opts.raman_mitigation.upper()].number
- except AssertionError, e:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(e.message, 'blue'),
- 'bold'))
- return
- if opts.system_id:
- interface_instance.data.system_id = opts.system_id
-
- if line.strip() == "create":
- stub.CreateChannelgroup(interface_instance)
- elif line.strip() == "update":
- stub.UpdateChannelgroup(interface_instance)
- elif line.strip() == "delete":
- stub.DeleteChannelgroup(interface_instance)
- return
+ if opts.system_id:
+ interface_instance.data.system_id = opts.system_id
+ if line.strip() == "create":
+ stub.CreateChannelgroup(interface_instance)
+ elif line.strip() == "update":
+ stub.UpdateChannelgroup(interface_instance)
+ elif line.strip() == "delete":
+ stub.DeleteChannelgroup(interface_instance)
+ return
+ except Exception, e:
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(e.message, 'blue'), 'bold'))
+ return
def help_channel_partition(self):
self.poutput(
@@ -340,8 +395,10 @@
Example:
-channel_partition create -n cpart-1-1 -a up -r 20 -o 0 -f false -m false
- -u serial_number -c cg-1
+channel_partition create -n "Freedom Tower"
+ -d "Channel Partition for Freedom Tower in Manhattan"
+ -a up -r 20 -o 0 -f false -m false -u serial_number
+ -c "Manhattan"
'''
)
@@ -385,16 +442,16 @@
update -flags <attributes>, delete -n <name>"""
# Ensure that a valid sub-command was provided
if line.strip() not in {"get", "create", "update", "delete"}:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(line.strip(), 'blue'),
- 'bold') + ' is not recognized')
+ self.poutput(self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(line.strip(), 'blue'),
+ 'bold') + ' is not recognized')
return
- stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
+ stub = voltha_pb2.VolthaGlobalServiceStub(self.get_channel())
if line.strip() == "get":
if self.device_id:
- cg, cpart, cp, ct, vont, ont, venet = \
+ cg, cpart, cp, ct, vont, ont, venet, tdp, tcont, gemport = \
self.get_interface_based_on_device()
print_pb_list_as_table("Channel Partitions for device ID = {}:"
.format(self.device_id), cpart, {},
@@ -405,26 +462,25 @@
interface.channelpartition_config,
{}, self.poutput)
return
-
- interface_instance = ChannelpartitionConfig(name = opts.name)
- interface_instance.interface.name = opts.name
- if opts.description:
- interface_instance.interface.description = opts.description
- interface_instance.interface.type = "channelpartition"
- if opts.enabled:
- if opts.enabled == "up":
- interface_instance.interface.enabled = True
- elif opts.enabled == "down":
- interface_instance.interface.enabled = False
- else:
- self.poutput(
- self.colorize('Error: ', 'red') + self.colorize(
- self.colorize('Invalid admin state parameter for \
- channel partition', 'blue'), 'bold'))
- return
- if opts.link_up_down_trap_enable:
- types = ["trap_disabled", "trap_enabled"]
- try:
+ try:
+ interface_instance = ChannelpartitionConfig(name = opts.name)
+ interface_instance.interface.name = opts.name
+ if opts.description:
+ interface_instance.interface.description = opts.description
+ interface_instance.interface.type = "channelpartition"
+ if opts.enabled:
+ if opts.enabled == "up":
+ interface_instance.interface.enabled = True
+ elif opts.enabled == "down":
+ interface_instance.interface.enabled = False
+ else:
+ self.poutput(
+ self.colorize('Error: ', 'red') + self.colorize(
+ self.colorize('Invalid admin state parameter for \
+ channel partition', 'blue'), 'bold'))
+ return
+ if opts.link_up_down_trap_enable:
+ types = ["trap_disabled", "trap_enabled"]
assert opts.link_up_down_trap_enable in types, \
'Invalid Enum value for Channel Partition link up \
down trap enable type \'{}\''\
@@ -433,47 +489,41 @@
ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
values_by_name[opts.link_up_down_trap_enable.upper()].\
number
- except AssertionError, e:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(e.message, 'blue'),
- 'bold'))
- return
-
- if opts.differential_fiber_distance:
- interface_instance.data.differential_fiber_distance = \
- opts.differential_fiber_distance
- if opts.closest_ont_distance:
- interface_instance.data.closest_ont_distance = \
- opts.closest_ont_distance
- if opts.fec_downstream:
- if opts.fec_downstream == 'true':
- interface_instance.data.fec_downstream = True
- elif opts.fec_downstream == 'false':
- interface_instance.data.fec_downstream = False
- else:
- m = 'Invalid boolean value for Channel Partition \
- fec_downstream \'{}\''.format(opts.fec_downstream)
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(m, 'blue'),
- 'bold'))
- return
- if opts.multicast_aes_indicator:
- if opts.multicast_aes_indicator == 'true':
- interface_instance.data.multicast_aes_indicator = True
- elif opts.multicast_aes_indicator == 'false':
- interface_instance.data.multicast_aes_indicator = False
- else:
- m = 'Invalid boolean value for Channel Partition \
- multicast_aes_indicator \'{}\''.format(
- opts.multicast_aes_indicator)
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(m, 'blue'),
- 'bold'))
- return
- if opts.authentication_method:
- auth_method_types = \
- ["serial_number", "loid", "registration_id", "omci", "dot1x"]
- try:
+ if opts.differential_fiber_distance:
+ interface_instance.data.differential_fiber_distance = \
+ opts.differential_fiber_distance
+ if opts.closest_ont_distance:
+ interface_instance.data.closest_ont_distance = \
+ opts.closest_ont_distance
+ if opts.fec_downstream:
+ if opts.fec_downstream == 'true':
+ interface_instance.data.fec_downstream = True
+ elif opts.fec_downstream == 'false':
+ interface_instance.data.fec_downstream = False
+ else:
+ m = 'Invalid boolean value for Channel Partition \
+ fec_downstream \'{}\''.format(opts.fec_downstream)
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(m, 'blue'),'bold'))
+ return
+ if opts.multicast_aes_indicator:
+ if opts.multicast_aes_indicator == 'true':
+ interface_instance.data.multicast_aes_indicator = True
+ elif opts.multicast_aes_indicator == 'false':
+ interface_instance.data.multicast_aes_indicator = False
+ else:
+ m = 'Invalid boolean value for Channel Partition \
+ multicast_aes_indicator \'{}\''.format(
+ opts.multicast_aes_indicator)
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(m, 'blue'), 'bold'))
+ return
+ if opts.authentication_method:
+ auth_method_types = \
+ ["serial_number", "loid", "registration_id",
+ "omci", "dot1x"]
assert opts.authentication_method in auth_method_types, \
'Invalid Enum value for Channel Partition \
authentication method \'{}\''.format(
@@ -481,21 +531,21 @@
interface_instance.data.authentication_method = \
bbf_fiber_types_pb2._AUTHMETHODTYPE.\
values_by_name[opts.authentication_method.upper()].number
- except AssertionError, e:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(e.message, 'blue'),
- 'bold'))
- return
- if opts.channelgroup_ref:
- interface_instance.data.channelgroup_ref = opts.channelgroup_ref
-
- if line.strip() == "create":
- stub.CreateChannelpartition(interface_instance)
- elif line.strip() == "update":
- stub.UpdateChannelpartition(interface_instance)
- elif line.strip() == "delete":
- stub.DeleteChannelpartition(interface_instance)
- return
+ if opts.channelgroup_ref:
+ interface_instance.data.channelgroup_ref = \
+ opts.channelgroup_ref
+ if line.strip() == "create":
+ stub.CreateChannelpartition(interface_instance)
+ elif line.strip() == "update":
+ stub.UpdateChannelpartition(interface_instance)
+ elif line.strip() == "delete":
+ stub.DeleteChannelpartition(interface_instance)
+ return
+ except Exception, e:
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(e.message, 'blue'), 'bold'))
+ return
def help_channel_pair(self):
self.poutput(
@@ -531,8 +581,9 @@
Example:
-channel_pair create -n cp-1 -a up -r unplanned_cp_speed -t channelpair -g cg-1
- -i 0 -p cpart-1-1 -o class_a
+channel_pair create -n "PON port" -d "Channel Pair for Freedom Tower" -a up
+ -r down_10_up_10 -t channelpair -g "Manhattan"
+ -p "Freedom Tower" -i 0 -o class_a
'''
)
@@ -572,16 +623,16 @@
update -flags <attributes>, delete -n <name>"""
# Ensure that a valid sub-command was provided
if line.strip() not in {"get", "create", "update", "delete"}:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(line.strip(), 'blue'),
- 'bold') + ' is not recognized')
+ self.poutput(self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(line.strip(), 'blue'),
+ 'bold') + ' is not recognized')
return
- stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
+ stub = voltha_pb2.VolthaGlobalServiceStub(self.get_channel())
if line.strip() == "get":
if self.device_id:
- cg, cpart, cp, ct, vont, ont, venet = \
+ cg, cpart, cp, ct, vont, ont, venet, tdp, tcont, gemport = \
self.get_interface_based_on_device()
print_pb_list_as_table("Channel Pairs for device ID = {}:"
.format(self.device_id), cp, {},
@@ -592,26 +643,25 @@
interface.channelpair_config,
{}, self.poutput)
return
-
- interface_instance = ChannelpairConfig(name = opts.name)
- interface_instance.interface.name = opts.name
- if opts.description:
- interface_instance.interface.description = opts.description
- interface_instance.interface.type = "channelpair"
- if opts.enabled:
- if opts.enabled == "up":
- interface_instance.interface.enabled = True
- elif opts.enabled == "down":
- interface_instance.interface.enabled = False
- else:
- self.poutput(
- self.colorize('Error: ', 'red') + self.colorize(
- self.colorize('Invalid admin state parameter for \
- channel pair', 'blue'), 'bold'))
- return
- if opts.link_up_down_trap_enable:
- types = ["trap_disabled", "trap_enabled"]
- try:
+ try:
+ interface_instance = ChannelpairConfig(name = opts.name)
+ interface_instance.interface.name = opts.name
+ if opts.description:
+ interface_instance.interface.description = opts.description
+ interface_instance.interface.type = "channelpair"
+ if opts.enabled:
+ if opts.enabled == "up":
+ interface_instance.interface.enabled = True
+ elif opts.enabled == "down":
+ interface_instance.interface.enabled = False
+ else:
+ self.poutput(
+ self.colorize('Error: ', 'red') + self.colorize(
+ self.colorize('Invalid admin state parameter for \
+ channel pair', 'blue'), 'bold'))
+ return
+ if opts.link_up_down_trap_enable:
+ types = ["trap_disabled", "trap_enabled"]
assert opts.link_up_down_trap_enable in types, \
'Invalid Enum value for Channel Pair link up down \
trap enable type \'{}\''.format(
@@ -620,48 +670,42 @@
ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
values_by_name[opts.link_up_down_trap_enable.upper()].\
number
- except AssertionError, e:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(e.message, 'blue'),
- 'bold'))
- return
-
- if opts.channelpair_linerate:
- interface_instance.data.channelpair_linerate = \
- opts.channelpair_linerate
- if opts.channelpair_type:
- interface_instance.data.channelpair_type = opts.channelpair_type
- if opts.channelgroup_ref:
- interface_instance.data.channelgroup_ref = opts.channelgroup_ref
- if opts.gpon_ponid_interval:
- interface_instance.data.gpon_ponid_interval = \
- opts.gpon_ponid_interval
- if opts.channelpartition_ref:
- interface_instance.data.channelpartition_ref = \
- opts.channelpartition_ref
- if opts.gpon_ponid_odn_class:
- class_types = ["class_a", "class_b", "class_b_plus", "class_c",
- "class_c_plus", "class_auto"]
- try:
+ if opts.channelpair_linerate:
+ interface_instance.data.channelpair_linerate = \
+ opts.channelpair_linerate
+ if opts.channelpair_type:
+ interface_instance.data.channelpair_type = \
+ opts.channelpair_type
+ if opts.channelgroup_ref:
+ interface_instance.data.channelgroup_ref = \
+ opts.channelgroup_ref
+ if opts.gpon_ponid_interval:
+ interface_instance.data.gpon_ponid_interval = \
+ opts.gpon_ponid_interval
+ if opts.channelpartition_ref:
+ interface_instance.data.channelpartition_ref = \
+ opts.channelpartition_ref
+ if opts.gpon_ponid_odn_class:
+ class_types = ["class_a", "class_b", "class_b_plus", "class_c",
+ "class_c_plus", "class_auto"]
assert opts.gpon_ponid_odn_class in class_types, \
'Invalid enum value for Channel Pair gpon pon id odn \
class \'{}\''.format(opts.gpon_ponid_odn_class)
interface_instance.data.gpon_ponid_odn_class = \
bbf_fiber_types_pb2._PONIDODNCLASSTYPE.\
values_by_name[opts.gpon_ponid_odn_class.upper()].number
- except AssertionError, e:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(e.message, 'blue'),
- 'bold'))
- return
-
- if line.strip() == "create":
- stub.CreateChannelpair(interface_instance)
- elif line.strip() == "update":
- stub.UpdateChannelpair(interface_instance)
- elif line.strip() == "delete":
- stub.DeleteChannelpair(interface_instance)
- return
+ if line.strip() == "create":
+ stub.CreateChannelpair(interface_instance)
+ elif line.strip() == "update":
+ stub.UpdateChannelpair(interface_instance)
+ elif line.strip() == "delete":
+ stub.DeleteChannelpair(interface_instance)
+ return
+ except Exception, e:
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(e.message, 'blue'), 'bold'))
+ return
def help_channel_termination(self):
self.poutput(
@@ -708,9 +752,9 @@
Example:
-channel_termination create -i f90bb953f988 -n cterm-1 -a up -r cp-1 -m false
- -w 0 -p 0 -s 0 -x 0 -b 0 -c raleigh -u localhost
-
+channel_termination create -i <DEVICE_ID> -n "PON port"
+ -d "Channel Termination for Freedom Tower" -a up
+ -r "PON port" -c "Freedom Tower OLT"
'''
)
@@ -767,16 +811,16 @@
update -flags <attributes>, delete -i <id> -n <name>"""
# Ensure that a valid sub-command was provided
if line.strip() not in {"get", "create", "update", "delete"}:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(line.strip(), 'blue'),
- 'bold') + ' is not recognized')
+ self.poutput(self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(line.strip(), 'blue'),
+ 'bold') + ' is not recognized')
return
- stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
+ stub = voltha_pb2.VolthaGlobalServiceStub(self.get_channel())
if line.strip() == "get":
if self.device_id:
- cg, cpart, cp, ct, vont, ont, venet = \
+ cg, cpart, cp, ct, vont, ont, venet, tdp, tcont, gemport = \
self.get_interface_based_on_device()
print_pb_list_as_table(
"Channel Terminations for device ID = {}:"
@@ -797,27 +841,26 @@
.format(d.id), interface.channeltermination_config,
{}, self.poutput)
return
-
- interface_instance = ChannelterminationConfig(
- id = opts.id, name = opts.name)
- interface_instance.interface.name = opts.name
- if opts.description:
- interface_instance.interface.description = opts.description
- interface_instance.interface.type = "channel-termination"
- if opts.enabled:
- if opts.enabled == "up":
- interface_instance.interface.enabled = True
- elif opts.enabled == "down":
- interface_instance.interface.enabled = False
- else:
- self.poutput(
- self.colorize('Error: ', 'red') + self.colorize(
- self.colorize('Invalid admin state parameter for \
- channel termination', 'blue'), 'bold'))
- return
- if opts.link_up_down_trap_enable:
- types = ["trap_disabled", "trap_enabled"]
- try:
+ try:
+ interface_instance = ChannelterminationConfig(
+ id = opts.id, name = opts.name)
+ interface_instance.interface.name = opts.name
+ if opts.description:
+ interface_instance.interface.description = opts.description
+ interface_instance.interface.type = "channel-termination"
+ if opts.enabled:
+ if opts.enabled == "up":
+ interface_instance.interface.enabled = True
+ elif opts.enabled == "down":
+ interface_instance.interface.enabled = False
+ else:
+ self.poutput(
+ self.colorize('Error: ', 'red') + self.colorize(
+ self.colorize('Invalid admin state parameter for \
+ channel termination', 'blue'), 'bold'))
+ return
+ if opts.link_up_down_trap_enable:
+ types = ["trap_disabled", "trap_enabled"]
assert opts.link_up_down_trap_enable in types, \
'Invalid Enum value for Channel Termination link up \
down trap enable type \'{}\''.format(
@@ -826,55 +869,55 @@
ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
values_by_name[opts.link_up_down_trap_enable.upper()].\
number
- except AssertionError, e:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(e.message, 'blue'),
- 'bold'))
- return
-
- if opts.channelpair_ref:
- interface_instance.data.channelpair_ref = opts.channelpair_ref
- if opts.meant_for_type_b_primary_role:
- if opts.meant_for_type_b_primary_role == 'true':
- interface_instance.data.meant_for_type_b_primary_role = True
- elif opts.meant_for_type_b_primary_role == 'false':
- interface_instance.data.meant_for_type_b_primary_role = False
- else:
- m = 'Invalid boolean value for Channel Termination \
- meant_for_type_b_primary_role \'{}\''.format(
- opts.meant_for_type_b_primary_role)
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(m, 'blue'),
- 'bold'))
- return
- if opts.ngpon2_twdm_admin_label:
- interface_instance.data.ngpon2_twdm_admin_label = \
- opts.ngpon2_twdm_admin_label
- if opts.ngpon2_ptp_admin_label:
- interface_instance.data.ngpon2_ptp_admin_label = \
- opts.ngpon2_ptp_admin_label
- if opts.xgs_ponid:
- interface_instance.data.xgs_ponid = opts.xgs_ponid
- if opts.xgpon_ponid:
- interface_instance.data.xgpon_ponid = opts.xgpon_ponid
- if opts.gpon_ponid:
- interface_instance.data.gpon_ponid = opts.gpon_ponid
- if opts.pon_tag:
- interface_instance.data.pon_tag = opts.pon_tag
- if opts.ber_calc_period:
- interface_instance.data.ber_calc_period = opts.ber_calc_period
- if opts.location:
- interface_instance.data.location = opts.location
- if opts.url_to_reach:
- interface_instance.data.url_to_reach = opts.url_to_reach
-
- if line.strip() == "create":
- stub.CreateChanneltermination(interface_instance)
- elif line.strip() == "update":
- stub.UpdateChanneltermination(interface_instance)
- elif line.strip() == "delete":
- stub.DeleteChanneltermination(interface_instance)
- return
+ if opts.channelpair_ref:
+ interface_instance.data.channelpair_ref = opts.channelpair_ref
+ if opts.meant_for_type_b_primary_role:
+ if opts.meant_for_type_b_primary_role == 'true':
+ interface_instance.data.meant_for_type_b_primary_role = \
+ True
+ elif opts.meant_for_type_b_primary_role == 'false':
+ interface_instance.data.meant_for_type_b_primary_role = \
+ False
+ else:
+ m = 'Invalid boolean value for Channel Termination \
+ meant_for_type_b_primary_role \'{}\''.format(
+ opts.meant_for_type_b_primary_role)
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(m, 'blue'), 'bold'))
+ return
+ if opts.ngpon2_twdm_admin_label:
+ interface_instance.data.ngpon2_twdm_admin_label = \
+ opts.ngpon2_twdm_admin_label
+ if opts.ngpon2_ptp_admin_label:
+ interface_instance.data.ngpon2_ptp_admin_label = \
+ opts.ngpon2_ptp_admin_label
+ if opts.xgs_ponid:
+ interface_instance.data.xgs_ponid = opts.xgs_ponid
+ if opts.xgpon_ponid:
+ interface_instance.data.xgpon_ponid = opts.xgpon_ponid
+ if opts.gpon_ponid:
+ interface_instance.data.gpon_ponid = opts.gpon_ponid
+ if opts.pon_tag:
+ interface_instance.data.pon_tag = opts.pon_tag
+ if opts.ber_calc_period:
+ interface_instance.data.ber_calc_period = opts.ber_calc_period
+ if opts.location:
+ interface_instance.data.location = opts.location
+ if opts.url_to_reach:
+ interface_instance.data.url_to_reach = opts.url_to_reach
+ if line.strip() == "create":
+ stub.CreateChanneltermination(interface_instance)
+ elif line.strip() == "update":
+ stub.UpdateChanneltermination(interface_instance)
+ elif line.strip() == "delete":
+ stub.DeleteChanneltermination(interface_instance)
+ return
+ except Exception, e:
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(e.message, 'blue'), 'bold'))
+ return
def help_vont_ani(self):
self.poutput(
@@ -908,12 +951,12 @@
-r: <string> preferred channel pair must be type of channel pair.
-t: <string> protection channel pair must be type of channel pair.
-u: <int> upstream channel speed of traffic.
--o <int> ONU id.
+-o: <int> ONU id.
Example:
-vont_ani create -n ontani-1-1-1 -a up -p cpart-1-1 -s ALCL00000001 -r cp-1
- -u 0 -o 1
+vont_ani create -n "Golden User" -d "Golden User in Freedom Tower" -a up
+ -p "Freedom Tower" -s "PSMO00000001" -r "PON port" -o 1
'''
)
@@ -959,16 +1002,16 @@
update -flags <attributes>, delete -n <name>"""
# Ensure that a valid sub-command was provided
if line.strip() not in {"get", "create", "update", "delete"}:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(line.strip(), 'blue'),
- 'bold') + ' is not recognized')
+ self.poutput(self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(line.strip(), 'blue'),
+ 'bold') + ' is not recognized')
return
- stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
+ stub = voltha_pb2.VolthaGlobalServiceStub(self.get_channel())
if line.strip() == "get":
if self.device_id:
- cg, cpart, cp, ct, vont, ont, venet = \
+ cg, cpart, cp, ct, vont, ont, venet, tdp, tcont, gemport = \
self.get_interface_based_on_device()
print_pb_list_as_table("VOnt Anis for device ID = {}:"
.format(self.device_id), vont, {},
@@ -979,26 +1022,25 @@
interface.v_ontani_config,
{}, self.poutput)
return
-
- interface_instance = VOntaniConfig(name = opts.name)
- interface_instance.interface.name = opts.name
- if opts.description:
- interface_instance.interface.description = opts.description
- interface_instance.interface.type = "v-ontani"
- if opts.enabled:
- if opts.enabled == "up":
- interface_instance.interface.enabled = True
- elif opts.enabled == "down":
- interface_instance.interface.enabled = False
- else:
- self.poutput(
- self.colorize('Error: ', 'red') + self.colorize(
- self.colorize('Invalid admin state parameter for \
- vont ani', 'blue'), 'bold'))
- return
- if opts.link_up_down_trap_enable:
- types = ["trap_disabled", "trap_enabled"]
- try:
+ try:
+ interface_instance = VOntaniConfig(name = opts.name)
+ interface_instance.interface.name = opts.name
+ if opts.description:
+ interface_instance.interface.description = opts.description
+ interface_instance.interface.type = "v-ontani"
+ if opts.enabled:
+ if opts.enabled == "up":
+ interface_instance.interface.enabled = True
+ elif opts.enabled == "down":
+ interface_instance.interface.enabled = False
+ else:
+ self.poutput(
+ self.colorize('Error: ', 'red') + self.colorize(
+ self.colorize('Invalid admin state parameter for \
+ vont ani', 'blue'), 'bold'))
+ return
+ if opts.link_up_down_trap_enable:
+ types = ["trap_disabled", "trap_enabled"]
assert opts.link_up_down_trap_enable in types, \
'Invalid Enum value for VOnt Ani link up down trap \
enable type \'{}\''.format(
@@ -1007,39 +1049,37 @@
ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
values_by_name[opts.link_up_down_trap_enable.upper()].\
number
- except AssertionError, e:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(e.message, 'blue'),
- 'bold'))
- return
-
- if opts.parent_ref:
- interface_instance.data.parent_ref = opts.parent_ref
- if opts.expected_serial_number:
- interface_instance.data.expected_serial_number = \
- opts.expected_serial_number
- if opts.expected_registration_id:
- interface_instance.data.expected_registration_id = \
- opts.expected_registration_id
- if opts.preferred_chanpair:
- interface_instance.data.preferred_chanpair = \
- opts.preferred_chanpair
- if opts.protection_chanpair:
- interface_instance.data.protection_chanpair = \
- opts.protection_chanpair
- if opts.upstream_channel_speed:
- interface_instance.data.upstream_channel_speed = \
- opts.upstream_channel_speed
- if opts.onu_id:
- interface_instance.data.onu_id = opts.onu_id
-
- if line.strip() == "create":
- stub.CreateVOntani(interface_instance)
- elif line.strip() == "update":
- stub.UpdateVOntani(interface_instance)
- elif line.strip() == "delete":
- stub.DeleteVOntani(interface_instance)
- return
+ if opts.parent_ref:
+ interface_instance.data.parent_ref = opts.parent_ref
+ if opts.expected_serial_number:
+ interface_instance.data.expected_serial_number = \
+ opts.expected_serial_number
+ if opts.expected_registration_id:
+ interface_instance.data.expected_registration_id = \
+ opts.expected_registration_id
+ if opts.preferred_chanpair:
+ interface_instance.data.preferred_chanpair = \
+ opts.preferred_chanpair
+ if opts.protection_chanpair:
+ interface_instance.data.protection_chanpair = \
+ opts.protection_chanpair
+ if opts.upstream_channel_speed:
+ interface_instance.data.upstream_channel_speed = \
+ opts.upstream_channel_speed
+ if opts.onu_id:
+ interface_instance.data.onu_id = opts.onu_id
+ if line.strip() == "create":
+ stub.CreateVOntani(interface_instance)
+ elif line.strip() == "update":
+ stub.UpdateVOntani(interface_instance)
+ elif line.strip() == "delete":
+ stub.DeleteVOntani(interface_instance)
+ return
+ except Exception, e:
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(e.message, 'blue'), 'bold'))
+ return
def help_ont_ani(self):
self.poutput(
@@ -1068,7 +1108,8 @@
Example:
-ont_ani create -n ontani-1-1-1 -a up -u true -m true
+ont_ani create -n "Golden User" -d "Golden User in Freedom Tower" -a up -u true
+ -m false
'''
)
@@ -1097,16 +1138,16 @@
update -flags <attributes>, delete -n <name>"""
# Ensure that a valid sub-command was provided
if line.strip() not in {"get", "create", "update", "delete"}:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(line.strip(), 'blue'),
- 'bold') + ' is not recognized')
+ self.poutput(self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(line.strip(), 'blue'),
+ 'bold') + ' is not recognized')
return
- stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
+ stub = voltha_pb2.VolthaGlobalServiceStub(self.get_channel())
if line.strip() == "get":
if self.device_id:
- cg, cpart, cp, ct, vont, ont, venet = \
+ cg, cpart, cp, ct, vont, ont, venet, tdp, tcont, gemport = \
self.get_interface_based_on_device()
print_pb_list_as_table("Ont Anis for device ID = {}:".format(
self.device_id), ont, {}, self.poutput)
@@ -1116,26 +1157,26 @@
interface.ontani_config,
{}, self.poutput)
return
-
- interface_instance = OntaniConfig(name = opts.name)
- interface_instance.interface.name = opts.name
- if opts.description:
- interface_instance.interface.description = opts.description
- interface_instance.interface.type = "ontani"
- if opts.enabled:
- if opts.enabled == "up":
- interface_instance.interface.enabled = True
- elif opts.enabled == "down":
- interface_instance.interface.enabled = False
- else:
- self.poutput(
- self.colorize('Error: ', 'red') + self.colorize(
- self.colorize('Invalid admin state parameter for \
- ont ani', 'blue'), 'bold'))
- return
- if opts.link_up_down_trap_enable:
- types = ["trap_disabled", "trap_enabled"]
- try:
+ try:
+ interface_instance = OntaniConfig(name = opts.name)
+ interface_instance.interface.name = opts.name
+ if opts.description:
+ interface_instance.interface.description = opts.description
+ interface_instance.interface.type = "ontani"
+ if opts.enabled:
+ if opts.enabled == "up":
+ interface_instance.interface.enabled = True
+ elif opts.enabled == "down":
+ interface_instance.interface.enabled = False
+ else:
+ self.poutput(
+ self.colorize('Error: ', 'red') + self.colorize(
+ self.colorize(
+ 'Invalid admin state parameter for ont ani',
+ 'blue'), 'bold'))
+ return
+ if opts.link_up_down_trap_enable:
+ types = ["trap_disabled", "trap_enabled"]
assert opts.link_up_down_trap_enable in types, \
'Invalid Enum value for Ont Ani link up down trap \
enable type \'{}\''.format(
@@ -1144,53 +1185,51 @@
ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
values_by_name[opts.link_up_down_trap_enable.upper()].\
number
- except AssertionError, e:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(e.message, 'blue'),
- 'bold'))
- return
-
- if opts.upstream_fec_indicator:
- if opts.upstream_fec_indicator == 'true':
- interface_instance.data.upstream_fec_indicator = True
- elif opts.upstream_fec_indicator == 'false':
- interface_instance.data.upstream_fec_indicator = False
- else:
- m = 'Invalid boolean value for Ont Ani \
- upstream_fec_indicator \'{}\''.format(
- opts.upstream_fec_indicator)
- self.poutput(
- self.colorize('Error: ', 'red') + self.colorize(
- self.colorize(m, 'blue'), 'bold'))
- return
- if opts.mgnt_gemport_aes_indicator:
- if opts.mgnt_gemport_aes_indicator == 'true':
- interface_instance.data.mgnt_gemport_aes_indicator = True
- elif opts.mgnt_gemport_aes_indicator == 'false':
- interface_instance.data.mgnt_gemport_aes_indicator = False
- else:
- m = 'Invalid boolean value for Ont Ani \
- mgnt_gemport_aes_indicator \'{}\''.format(
- opts.mgnt_gemport_aes_indicator)
- self.poutput(
- self.colorize('Error: ', 'red') + self.colorize(
- self.colorize(m, 'blue'), 'bold'))
- return
-
- if line.strip() == "create":
- stub.CreateOntani(interface_instance)
- elif line.strip() == "update":
- stub.UpdateOntani(interface_instance)
- elif line.strip() == "delete":
- stub.DeleteOntani(interface_instance)
- return
+ if opts.upstream_fec_indicator:
+ if opts.upstream_fec_indicator == 'true':
+ interface_instance.data.upstream_fec_indicator = True
+ elif opts.upstream_fec_indicator == 'false':
+ interface_instance.data.upstream_fec_indicator = False
+ else:
+ m = 'Invalid boolean value for Ont Ani \
+ upstream_fec_indicator \'{}\''.format(
+ opts.upstream_fec_indicator)
+ self.poutput(
+ self.colorize('Error: ', 'red') + self.colorize(
+ self.colorize(m, 'blue'), 'bold'))
+ return
+ if opts.mgnt_gemport_aes_indicator:
+ if opts.mgnt_gemport_aes_indicator == 'true':
+ interface_instance.data.mgnt_gemport_aes_indicator = True
+ elif opts.mgnt_gemport_aes_indicator == 'false':
+ interface_instance.data.mgnt_gemport_aes_indicator = False
+ else:
+ m = 'Invalid boolean value for Ont Ani \
+ mgnt_gemport_aes_indicator \'{}\''.format(
+ opts.mgnt_gemport_aes_indicator)
+ self.poutput(
+ self.colorize('Error: ', 'red') + self.colorize(
+ self.colorize(m, 'blue'), 'bold'))
+ return
+ if line.strip() == "create":
+ stub.CreateOntani(interface_instance)
+ elif line.strip() == "update":
+ stub.UpdateOntani(interface_instance)
+ elif line.strip() == "delete":
+ stub.DeleteOntani(interface_instance)
+ return
+ except Exception, e:
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(e.message, 'blue'), 'bold'))
+ return
def help_v_enet(self):
self.poutput(
'''
v_enet [get | create | update | delete] [-n <name>] [-d <description>]
[-a <admin state>] [-l <link up down trap enable type>]
- [-r <ont ani reference>]
+ [-r <vont ani reference>]
get: displays existing venets
Required flags: None
@@ -1207,11 +1246,11 @@
-d: <string> description of venet.
-a: <string> admin state of venet.
-l: <enum> link up down trap enable type.
--r: <string> ont ani reference of this venet.
+-r: <string> vont ani reference of this venet.
Example:
-v_enet create -n venet-1 -a up -r ontani-1-1-1
+v_enet create -n "Enet UNI 1" -d "Ethernet port - 1" -a up -r "Golden User"
'''
)
@@ -1225,8 +1264,8 @@
make_option('-l', '--trap', action="store",
dest='link_up_down_trap_enable', type='string',
help='link up down trap enable type', default=None),
- make_option('-r', '--ont_ref', action='store', dest='v_ontani_ref',
- type='string', help='ont ani reference', default=None),
+ make_option('-r', '--vont_ref', action='store', dest='v_ontani_ref',
+ type='string', help='vont ani reference', default=None),
])
def do_v_enet(self, line, opts):
@@ -1234,18 +1273,18 @@
update -flags <attributes>, delete -n <name>"""
# Ensure that a valid sub-command was provided
if line.strip() not in {"get", "create", "update", "delete"}:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(line.strip(), 'blue'),
- 'bold') + ' is not recognized')
+ self.poutput(self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(line.strip(), 'blue'),
+ 'bold') + ' is not recognized')
return
- stub = voltha_pb2.VolthaLocalServiceStub(self.get_channel())
+ stub = voltha_pb2.VolthaGlobalServiceStub(self.get_channel())
if line.strip() == "get":
if self.device_id:
- cg, cpart, cp, ct, vont, ont, venet = \
+ cg, cpart, cp, ct, vont, ont, venet, tdp, tcont, gemport = \
self.get_interface_based_on_device()
- print_pb_list_as_table("VEnet for device ID = {}:"
+ print_pb_list_as_table("VEnets for device ID = {}:"
.format(self.device_id), venet, {},
self.poutput)
else:
@@ -1254,26 +1293,25 @@
interface.v_enet_config,
{}, self.poutput)
return
-
- interface_instance = VEnetConfig(name = opts.name)
- interface_instance.interface.name = opts.name
- if opts.description:
- interface_instance.interface.description = opts.description
- interface_instance.interface.type = "v-enet"
- if opts.enabled:
- if opts.enabled == "up":
- interface_instance.interface.enabled = True
- elif opts.enabled == "down":
- interface_instance.interface.enabled = False
- else:
- self.poutput(
- self.colorize('Error: ', 'red') + self.colorize(
- self.colorize('Invalid admin state parameter for \
- venet', 'blue'), 'bold'))
- return
- if opts.link_up_down_trap_enable:
- types = ["trap_disabled", "trap_enabled"]
- try:
+ try:
+ interface_instance = VEnetConfig(name = opts.name)
+ interface_instance.interface.name = opts.name
+ if opts.description:
+ interface_instance.interface.description = opts.description
+ interface_instance.interface.type = "v-enet"
+ if opts.enabled:
+ if opts.enabled == "up":
+ interface_instance.interface.enabled = True
+ elif opts.enabled == "down":
+ interface_instance.interface.enabled = False
+ else:
+ self.poutput(
+ self.colorize('Error: ', 'red') + self.colorize(
+ self.colorize('Invalid admin state parameter for \
+ venet', 'blue'), 'bold'))
+ return
+ if opts.link_up_down_trap_enable:
+ types = ["trap_disabled", "trap_enabled"]
assert opts.link_up_down_trap_enable in types, \
'Invalid Enum value for Venet link up down trap \
enable type \'{}\''.format(
@@ -1282,19 +1320,351 @@
ietf_interfaces_pb2._INTERFACE_LINKUPDOWNTRAPENABLETYPE.\
values_by_name[opts.link_up_down_trap_enable.upper()].\
number
- except AssertionError, e:
- self.poutput(self.colorize('Error: ', 'red') + \
- self.colorize(self.colorize(e.message, 'blue'),
- 'bold'))
- return
+ if opts.v_ontani_ref:
+ interface_instance.data.v_ontani_ref = opts.v_ontani_ref
+ if line.strip() == "create":
+ stub.CreateVEnet(interface_instance)
+ elif line.strip() == "update":
+ stub.UpdateVEnet(interface_instance)
+ elif line.strip() == "delete":
+ stub.DeleteVEnet(interface_instance)
+ return
+ except Exception, e:
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(e.message, 'blue'), 'bold'))
+ return
- if opts.v_ontani_ref:
- interface_instance.data.v_ontani_ref = opts.v_ontani_ref
+ def help_traffic_descriptor_profile(self):
+ self.poutput(
+'''
+traffic_descriptor_profile [get | create | update | delete]
+ [-n <name>] [-f <fixed bandwidth>]
+ [-a <assured bandwidth>] [-m <maximum bandwidth>]
+ [-p <priority>] [-w <weight>]
+ [-e <additional bw eligibility indicator>]
- if line.strip() == "create":
- stub.CreateVEnet(interface_instance)
- elif line.strip() == "update":
- stub.UpdateVEnet(interface_instance)
- elif line.strip() == "delete":
- stub.DeleteVEnet(interface_instance)
- return
+get: displays existing traffic descriptor profiles
+ Required flags: None
+create: creates traffic descriptor profile with the parameters specified with
+ -n, -f, -a, -p, -w, and -e.
+ Required flags: <name>, <fixed bandwidth>, <assured bandwidth>,
+ <maximum bandwidth>
+update: updates existing traffic descriptor profile specified with parameter -n
+ by changing its parameter values specified with -f, -a, -p, -w, and -e.
+ Required flags: <name>
+delete: deletes traffic descriptor profile specified with parameter -n.
+ Required flags: <name>
+
+-n: <string> name of traffic descriptor profile.
+-f: <int> fixed bandwidth that represents the reserved portion of the link
+ capacity that is allocated to the given traffic flow, regardless
+ of its traffic demand and the overall traffic load conditions.
+-a: <int> assured bandwidth that represents a portion of the link capacity
+ that is allocated to the given traffic flow as long as the flow
+ has unsatisfied traffic demand, regardless of the overall traffic
+ conditions.
+-m: <int> maximum bandwidth that represents the upper limit on the total
+ bandwidth that can be allocated to the traffic flow under any
+ traffic conditions.
+-p: <int> priority that is used for scheduling traffic on a TCont.
+-w: <int> weight that is used for scheduling traffic on a TCont.
+-e: <enum> additional bandwidth eligibility indicator that in case of
+ rate-proportional assignment of additional bandwidth, it can be
+ provisioned to either value (non-assured-sharing,
+ best-effort-sharing, or none).
+
+Example:
+
+traffic_descriptor_profile create -n "TDP 1" -f 100000 -a 500000 -m 1000000
+ -p 1 -w 1
+ -e additional_bw_eligibility_indicator_none
+'''
+ )
+
+ @options([
+ make_option('-n', '--name', action="store", dest='name', type='string',
+ help='name of traffic descriptor profile', default=None),
+ make_option('-f', '--fixed_bw', action="store", dest='fixed_bandwidth',
+ type='int', help='fixed bandwidth of traffic descriptor',
+ default=None),
+ make_option('-a', '--assured_bw', action="store",
+ dest='assured_bandwidth', type='int',
+ help='assured bandwidth of traffic descriptor',
+ default=None),
+ make_option('-m', '--maximum_bw', action="store",
+ dest='maximum_bandwidth', type='int',
+ help='maximum bandwidth of traffic descriptor',
+ default=None),
+ make_option('-p', '--priority', action='store', dest='priority',
+ type='int',
+ help='priority used for scheduling traffic on a TCont',
+ default=None),
+ make_option('-w', '--weight', action='store', dest='weight',
+ type='int',
+ help='weight used for scheduling traffic on a TCont',
+ default=None),
+ make_option('-e', '--add_bw_eligibility_indicator', action='store',
+ dest='additional_bw_eligibility_indicator', type='string',
+ help='additional bandwidth eligibility indicator',
+ default=None),
+ ])
+
+ def do_traffic_descriptor_profile(self, line, opts):
+ """traffic_descriptor_profile get, create -flags <attributes>,
+ update -flags <attributes>, delete -n <name>"""
+ # Ensure that a valid sub-command was provided
+ if line.strip() not in {"get", "create", "update", "delete"}:
+ self.poutput(self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(line.strip(), 'blue'),
+ 'bold') + ' is not recognized')
+ return
+
+ stub = voltha_pb2.VolthaGlobalServiceStub(self.get_channel())
+
+ if line.strip() == "get":
+ if self.device_id:
+ cg, cpart, cp, ct, vont, ont, venet, tdp, tcont, gemport = \
+ self.get_interface_based_on_device()
+ print_pb_list_as_table(
+ "Traffic Descriptor Profiles for device ID = {}:"
+ .format(self.device_id), tdp, {}, self.poutput)
+ else:
+ tdp = stub.GetAllTrafficDescriptorProfileData(Empty())
+ print_pb_list_as_table("Traffic Descriptor Profiles:",
+ tdp.traffic_descriptor_profiles,
+ {}, self.poutput)
+ return
+ try:
+ traffic_descriptor = TrafficDescriptorProfileData(name = opts.name)
+ if opts.fixed_bandwidth:
+ traffic_descriptor.fixed_bandwidth = opts.fixed_bandwidth
+ if opts.assured_bandwidth:
+ traffic_descriptor.assured_bandwidth = opts.assured_bandwidth
+ if opts.maximum_bandwidth:
+ traffic_descriptor.maximum_bandwidth = opts.maximum_bandwidth
+ if opts.priority:
+ traffic_descriptor.priority = opts.priority
+ if opts.weight:
+ traffic_descriptor.weight = opts.weight
+ if opts.additional_bw_eligibility_indicator:
+ eligibility_indicator = [
+ "additional_bw_eligibility_indicator_none",
+ "additional_bw_eligibility_indicator_best_effort_sharing",
+ "additional_bw_eligibility_indicator_non_assured_sharing"]
+ assert opts.additional_bw_eligibility_indicator in \
+ eligibility_indicator, 'Invalid Enum value for Traffic \
+ Descriptor Profile additional bandwidth eligibility \
+ indicator \'{}\''\
+ .format(opts.additional_bw_eligibility_indicator)
+ traffic_descriptor.additional_bw_eligibility_indicator = \
+ bbf_fiber_traffic_descriptor_profile_body_pb2.\
+ _ADDITIONALBWELIGIBILITYINDICATORTYPE.\
+ values_by_name\
+ [opts.additional_bw_eligibility_indicator.upper()].number
+ if line.strip() == "create":
+ stub.CreateTrafficDescriptorProfileData(traffic_descriptor)
+ elif line.strip() == "update":
+ stub.UpdateTrafficDescriptorProfileData(traffic_descriptor)
+ elif line.strip() == "delete":
+ stub.DeleteTrafficDescriptorProfileData(traffic_descriptor)
+ return
+ except Exception, e:
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(e.message, 'blue'), 'bold'))
+ return
+
+ def help_tcont(self):
+ self.poutput(
+'''
+tcont [get | create | update | delete] [-n <name>] [-r <interface reference>]
+ [-t <traffic descriptor profile reference>]
+
+get: displays existing tconts
+ Required flags: None
+create: creates tcont with the parameters specified with -n, -r, and -t.
+ Required flags: <name>, <interface reference>,
+ <traffic descriptor profile reference>
+update: updates existing tcont specified with parameter -n by changing its
+ parameter values specified with -r, -t.
+ Required flags: <name>
+delete: deletes tcont specified with parameter -n.
+ Required flags: <name>
+
+-n: <string> name of tcont.
+-r: <string> reference to vont ani interface.
+-t: <string> reference to an existing traffic descriptor profile.
+
+Example:
+
+tcont create -n "TCont 1" -r "Golden User" -t "TDP 1"
+'''
+ )
+
+ @options([
+ make_option('-n', '--name', action="store", dest='name', type='string',
+ help='name of tcont', default=None),
+ make_option('-r', '--ref', action="store", dest='interface_reference',
+ type='string', help='reference to vont ani interface',
+ default=None),
+ make_option('-t', '--tdp_ref', action="store",
+ dest='traffic_descriptor_profile_ref', type='string',
+ help='reference to an existing traffic descriptor profile',
+ default=None),
+ ])
+
+ def do_tcont(self, line, opts):
+ """tcont get, create -flags <attributes>,
+ update -flags <attributes>, delete -n <name>"""
+ # Ensure that a valid sub-command was provided
+ if line.strip() not in {"get", "create", "update", "delete"}:
+ self.poutput(self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(line.strip(), 'blue'),
+ 'bold') + ' is not recognized')
+ return
+
+ stub = voltha_pb2.VolthaGlobalServiceStub(self.get_channel())
+
+ if line.strip() == "get":
+ if self.device_id:
+ cg, cpart, cp, ct, vont, ont, venet, tdp, tcont, gemport = \
+ self.get_interface_based_on_device()
+ print_pb_list_as_table("TConts for device ID = {}:".format(
+ self.device_id), tcont, {}, self.poutput)
+ else:
+ tconts = stub.AllTcontsConfigData(Empty())
+ print_pb_list_as_table(
+ "TConts:", tconts.tconts_config, {}, self.poutput)
+ return
+
+ try:
+ tcont = TcontsConfigData(name = opts.name)
+ if opts.interface_reference:
+ tcont.interface_reference = opts.interface_reference
+ if opts.traffic_descriptor_profile_ref:
+ tcont.traffic_descriptor_profile_ref = \
+ opts.traffic_descriptor_profile_ref
+ if line.strip() == "create":
+ stub.CreateTcontsConfigData(tcont)
+ elif line.strip() == "update":
+ stub.UpdateTcontsConfigData(tcont)
+ elif line.strip() == "delete":
+ stub.DeleteTcontsConfigData(tcont)
+ return
+ except Exception, e:
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(e.message, 'blue'), 'bold'))
+ return
+
+ def help_gem_port(self):
+ self.poutput(
+'''
+gem_port [get | create | update | delete]
+ [-n <name>] [-r <interface reference>] [-c <traffic class>]
+ [-a <aes indicator>] [-t <tcont reference>]
+
+get: displays existing gemports
+ Required flags: None
+create: creates gemport with the parameters specified with
+ -n, -r, -c, -a, and -t.
+ Required flags: <name>, <interface reference>, <traffic class>
+update: updates existing gemport specified with parameter -n
+ by changing its parameter values specified with -r, -c, -a, and -t.
+ Required flags: <name>
+delete: deletes gemport specified with parameter -n.
+ Required flags: <name>
+
+-n: <string> name of gemport.
+-r: <string> reference to v_enet interface.
+-c: <int> traffic class value for gemport.
+-a: <bool> aes indicator that is used to designate whether AES should be
+ enabled/disabled for all bi-directional GEM ports associated with
+ this ONT.
+-t: <string> tcont reference that is for the purpose of upstream scheduling in
+ the ONU, a gemport needs to refer to the tcont into which it feeds
+ upstream traffic.
+
+Example:
+
+gem_port create -n "GEMPORT 1" -r "Enet UNI 1" -c 0 -a true -t "TCont 1"
+'''
+ )
+
+ @options([
+ make_option('-n', '--name', action="store", dest='name', type='string',
+ help='name of gemport', default=None),
+ make_option('-r', '--itf_ref', action="store", dest='itf_ref',
+ type='string', help='reference to v_enet interface',
+ default=None),
+ make_option('-c', '--traffic_class', action="store",
+ dest='traffic_class', type='int',
+ help='traffic class value for gemport', default=None),
+ make_option('-a', '--aes_indicator', action="store",
+ dest='aes_indicator', type='string',
+ help='aes indicator to designate if AES enabled/disabled',
+ default=None),
+ make_option('-t', '--tcont_ref', action='store', dest='tcont_ref',
+ type='string',
+ help='tcont reference for purpose of us scheduling in ONU',
+ default=None),
+ ])
+
+ def do_gem_port(self, line, opts):
+ """gem_port get, create -flags <attributes>,
+ update -flags <attributes>, delete -n <name>"""
+ # Ensure that a valid sub-command was provided
+ if line.strip() not in {"get", "create", "update", "delete"}:
+ self.poutput(self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(line.strip(), 'blue'),
+ 'bold') + ' is not recognized')
+ return
+
+ stub = voltha_pb2.VolthaGlobalServiceStub(self.get_channel())
+
+ if line.strip() == "get":
+ if self.device_id:
+ cg, cpart, cp, ct, vont, ont, venet, tdp, tcont, gemport = \
+ self.get_interface_based_on_device()
+ print_pb_list_as_table(
+ "Gem Ports for device ID = {}:"
+ .format(self.device_id), gemport, {}, self.poutput)
+ else:
+ gemport = stub.GetAllGemportsConfigData(Empty())
+ print_pb_list_as_table("Gem Ports:",
+ gemport.gemports_config,
+ {}, self.poutput)
+ return
+ try:
+ gemport = GemportsConfigData(name = opts.name)
+ if opts.itf_ref:
+ gemport.itf_ref = opts.itf_ref
+ if opts.traffic_class:
+ gemport.traffic_class = opts.traffic_class
+ if opts.aes_indicator:
+ if opts.aes_indicator == 'true':
+ gemport.aes_indicator = True
+ elif opts.aes_indicator == 'false':
+ gemport.aes_indicator = False
+ else:
+ m = 'Invalid boolean value for Gem Port \
+ aes_indicator \'{}\''.format(opts.aes_indicator)
+ self.poutput(
+ self.colorize('Error: ', 'red') + self.colorize(
+ self.colorize(m, 'blue'), 'bold'))
+ return
+ if opts.tcont_ref:
+ gemport.tcont_ref = opts.tcont_ref
+ if line.strip() == "create":
+ stub.CreateGemportsConfigData(gemport)
+ elif line.strip() == "update":
+ stub.UpdateGemportsConfigData(gemport)
+ elif line.strip() == "delete":
+ stub.DeleteGemportsConfigData(gemport)
+ return
+ except Exception, e:
+ self.poutput(
+ self.colorize('Error: ', 'red') +
+ self.colorize(self.colorize(e.message, 'blue'), 'bold'))
+ return
diff --git a/ponsim/ponsim.py b/ponsim/ponsim.py
index 619beb1..219f1c5 100644
--- a/ponsim/ponsim.py
+++ b/ponsim/ponsim.py
@@ -477,13 +477,91 @@
self.log = structlog.get_logger()
def CreateInterface(self, request):
- self.log.info("create-interface-request", interface_type = request.WhichOneof("interface_type"), data = request)
+ self.log.info("create-interface-request",
+ interface_type=request.WhichOneof("interface_type"),
+ data=request)
return
def UpdateInterface(self, request):
- self.log.info("update-interface-request", interface_type = request.WhichOneof("interface_type"), data = request)
+ self.log.info("update-interface-request",
+ interface_type=request.WhichOneof("interface_type"),
+ data=request)
return
def RemoveInterface(self, request):
- self.log.info("remove-interface-request", interface_type = request.WhichOneof("interface_type"), data = request)
+ self.log.info("remove-interface-request",
+ interface_type=request.WhichOneof("interface_type"),
+ data=request)
+ return
+
+ def CreateTcont(self, request, request2):
+ self.log.info("create-tcont-request",
+ tcont_config_data=request,
+ traffic_descriptor_profile_config_data=request2)
+ return
+
+ def UpdateTcont(self, request, request2):
+ self.log.info("update-tcont-request",
+ tcont_config_data=request,
+ traffic_descriptor_profile_config_data=request2)
+ return
+
+ def RemoveTcont(self, request, request2):
+ self.log.info("remove-tcont-request",
+ tcont_config_data=request,
+ traffic_descriptor_profile_config_data=request2)
+ return
+
+ def CreateGemport(self, request):
+ self.log.info("create-gemport-request",
+ interface_type=request.WhichOneof("interface_type"),
+ data=request)
+ return
+
+ def UpdateGemport(self, request):
+ self.log.info("update-gemport-request",
+ interface_type=request.WhichOneof("interface_type"),
+ data=request)
+ return
+
+ def RemoveGemport(self, request):
+ self.log.info("remove-gemport-request",
+ interface_type=request.WhichOneof("interface_type"),
+ data=request)
+ return
+
+ def CreateMulticastGemport(self, request):
+ self.log.info("create-multicast-gemport-request",
+ interface_type=request.WhichOneof("interface_type"),
+ data=request)
+ return
+
+ def UpdateMulticastGemport(self, request):
+ self.log.info("update-multicast-gemport-request",
+ interface_type=request.WhichOneof("interface_type"),
+ data=request)
+ return
+
+ def RemoveMulticastGemport(self, request):
+ self.log.info("remove-multicast-gemport-request",
+ interface_type=request.WhichOneof("interface_type"),
+ data=request)
+ return
+
+ def CreateMulticastDistributionSet(self, request):
+ self.log.info("create-multicast-distribution-set-request",
+ interface_type=request.WhichOneof("interface_type"),
+ data=request)
+ return
+
+ def UpdateMulticastDistributionSet(self, request):
+ self.log.info("update-multicast-distribution-set-request",
+ interface_type=request.WhichOneof("interface_type"),
+ data=request)
+ return
+
+ def RemoveMulticastDistributionSet(self, request):
+ self.log.info("remove-multicast-distribution-set-request",
+ interface_type=request.WhichOneof("interface_type"),
+ data=request)
return
diff --git a/ponsim/ponsim_servicer.py b/ponsim/ponsim_servicer.py
index b7a524f..ccfec38 100644
--- a/ponsim/ponsim_servicer.py
+++ b/ponsim/ponsim_servicer.py
@@ -69,3 +69,57 @@
def RemoveInterface(self, request, context):
self.x_pon_sim.RemoveInterface(request)
return Empty()
+
+ def CreateTcont(self, request, context):
+ self.x_pon_sim.CreateTcont(
+ request.tconts_config_data,
+ request.traffic_descriptor_profile_config_data)
+ return Empty()
+
+ def UpdateTcont(self, request, context):
+ self.x_pon_sim.UpdateTcont(
+ request.tconts_config_data,
+ request.traffic_descriptor_profile_config_data)
+ return Empty()
+
+ def RemoveTcont(self, request, context):
+ self.x_pon_sim.RemoveTcont(
+ request.tconts_config_data,
+ request.traffic_descriptor_profile_config_data)
+ return Empty()
+
+ def CreateGemport(self, request, context):
+ self.x_pon_sim.CreateGemport(request)
+ return Empty()
+
+ def UpdateGemport(self, request, context):
+ self.x_pon_sim.UpdateGemport(request)
+ return Empty()
+
+ def RemoveGemport(self, request, context):
+ self.x_pon_sim.RemoveGemport(request)
+ return Empty()
+
+ def CreateMulticastGemport(self, request, context):
+ self.x_pon_sim.CreateMulticastGemport(request)
+ return Empty()
+
+ def UpdateMulticastGemport(self, request, context):
+ self.x_pon_sim.UpdateMulticastGemport(request)
+ return Empty()
+
+ def RemoveMulticastGemport(self, request, context):
+ self.x_pon_sim.RemoveMulticastGemport(request)
+ return Empty()
+
+ def CreateMulticastDistributionSet(self, request, context):
+ self.x_pon_sim.CreateMulticastDistributionSet(request)
+ return Empty()
+
+ def UpdateMulticastDistributionSet(self, request, context):
+ self.x_pon_sim.UpdateMulticastDistributionSet(request)
+ return Empty()
+
+ def RemoveMulticastDistributionSet(self, request, context):
+ self.x_pon_sim.RemoveMulticastDistributionSet(request)
+ return Empty()
diff --git a/tests/itests/voltha/test_voltha_xpon.py b/tests/itests/voltha/test_voltha_xpon.py
index 201eb54..9136e67 100644
--- a/tests/itests/voltha/test_voltha_xpon.py
+++ b/tests/itests/voltha/test_voltha_xpon.py
@@ -5,6 +5,9 @@
from voltha.protos import bbf_fiber_base_pb2 as fb
from voltha.protos.device_pb2 import Device
+from voltha.protos import bbf_fiber_gemport_body_pb2 as gemport
+from voltha.protos import bbf_fiber_tcont_body_pb2 as tcont
+from voltha.protos import bbf_fiber_traffic_descriptor_profile_body_pb2 as tdp
from common.utils.consulhelpers import get_endpoint_from_consul
'''
@@ -146,6 +149,38 @@
}
}
},
+ {'tdp-add': {
+ 'pb2': tdp.TrafficDescriptorProfileData(),
+ 'rpc': {
+ "name": "TDP 1",
+ "assured_bandwidth": "500000",
+ "additional_bw_eligibility_indicator": \
+"ADDITIONAL_BW_ELIGIBILITY_INDICATOR_NONE",
+ "fixed_bandwidth": "100000",
+ "maximum_bandwidth": "1000000",
+ }
+ }
+ },
+ {'tcont-add': {
+ 'pb2': tcont.TcontsConfigData(),
+ 'rpc': {
+ "interface_reference": "Golden User",
+ "traffic_descriptor_profile_ref": "TDP 1",
+ "name": "TCont 1"
+ }
+ }
+ },
+ {'gemport-add': {
+ 'pb2': gemport.GemportsConfigData(),
+ 'rpc': {
+ "aes_indicator": True,
+ "name": "GEMPORT 1",
+ "traffic_class": 0,
+ "itf_ref": "Enet UNI 1",
+ "tcont_ref": "TCont 1",
+ }
+ }
+ },
{'cg-mod': {
'pb2': fb.ChannelgroupConfig(),
'rpc': {
@@ -163,6 +198,18 @@
}
}
},
+ {'gemport-del': {
+ 'pb2': gemport.GemportsConfigData(),
+ 'rpc': {"name": "GEMPORT 1"}}
+ },
+ {'tcont-del': {
+ 'pb2': tcont.TcontsConfigData(),
+ 'rpc': {"name": "TCont 1"}}
+ },
+ {'tdp-del': {
+ 'pb2': tdp.TrafficDescriptorProfileData(),
+ 'rpc': {"name": "TDP 1"}}
+ },
{'venet-del': {
'pb2': fb.VEnetConfig(),
'rpc': {"name": "Enet UNI 1"}}
@@ -298,20 +345,12 @@
# Method to check if the result is same as the change requested
def search(self, req, result):
- dict1 = MessageToDict(req, preserving_proto_field_name = True)
- for item in result:
- if(isinstance(item, dict)):
- for k,v in item.items():
- if(v == dict1['name']):
- dict2 = item
- break
- itfDiff = [k for k in dict1['interface'] if dict1['interface'][k] \
- != dict2['interface'][k]]
- dataDiff = [k for k in dict1['data'] if dict1['data'][k] \
- != dict2['data'][k]]
- if(len(itfDiff) == 0 and len(dataDiff) == 0):
- return True
- return False
+ dict1 = MessageToDict(req,
+ including_default_value_fields = True,
+ preserving_proto_field_name = True)
+ result['id'] = ''
+ return dict1 == result
+
#~~~~~~~~~~~~~~ Function to create test cases on the fly ~~~~~~~~~~~~~~~~
def create_dynamic_method(key, value):
@@ -329,18 +368,24 @@
'ontani': {'type':'ont_anis',
'config':'ontani_config'},
'venet': {'type':'v_enets',
- 'config':'v_enet_config'}
+ 'config':'v_enet_config'},
+ 'gemport':{'type':'gemports',
+ 'config':'gemports_config'},
+ 'tcont': {'type':'tconts',
+ 'config':'tconts_config'},
+ 'tdp': {'type':'traffic_descriptor_profiles',
+ 'config':'traffic_descriptor_profiles'}
}
def _add(self, type, config, req, name):
result, prev_len = self.add(type, config, req, name)
self.assertEqual(result[config][prev_len]['name'], name)
self.assertEqual(len(result[config]), prev_len+1)
- self.assertEqual(self.search(req, result[config]), True)
+ self.assertEqual(self.search(req, result[config][0]), True)
def _mod(self, type, config, req, name):
result = self.modify(type, req, name)
- self.assertEqual(self.search(req, result[config]), True)
+ self.assertEqual(self.search(req, result[config][0]), True)
def _del(self, type, config, req, name):
result, prev_len = self.remove(type, config, name)
diff --git a/voltha/adapters/adtran_olt/adtran_olt.py b/voltha/adapters/adtran_olt/adtran_olt.py
index 67ac4f2..e44a15b 100644
--- a/voltha/adapters/adtran_olt/adtran_olt.py
+++ b/voltha/adapters/adtran_olt/adtran_olt.py
@@ -423,3 +423,39 @@
:return: None
"""
raise NotImplementedError()
+
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def create_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
diff --git a/voltha/adapters/broadcom_onu/broadcom_onu.py b/voltha/adapters/broadcom_onu/broadcom_onu.py
index 968fc42..bef5adf 100644
--- a/voltha/adapters/broadcom_onu/broadcom_onu.py
+++ b/voltha/adapters/broadcom_onu/broadcom_onu.py
@@ -179,9 +179,6 @@
if handler is not None:
handler.event_messages.put(msg)
- def suppress_alarm(self, filter):
- raise NotImplementedError()
-
def create_interface(self, device, data):
log.info('create-interface', device_id=device.id)
if device.proxy_address.channel_id in self.devices_handlers:
@@ -206,6 +203,45 @@
def receive_onu_detect_state(self, device_id, state):
raise NotImplementedError()
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def create_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def suppress_alarm(self, filter):
+ raise NotImplementedError()
+
def unsuppress_alarm(self, filter):
raise NotImplementedError()
diff --git a/voltha/adapters/dpoe_onu/dpoe_onu.py b/voltha/adapters/dpoe_onu/dpoe_onu.py
index 09e7f6e..2bf9397 100644
--- a/voltha/adapters/dpoe_onu/dpoe_onu.py
+++ b/voltha/adapters/dpoe_onu/dpoe_onu.py
@@ -437,6 +437,42 @@
def receive_onu_detect_state(self, device_id, state):
raise NotImplementedError()
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def create_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
def suppress_alarm(self, filter):
raise NotImplementedError()
diff --git a/voltha/adapters/iadapter.py b/voltha/adapters/iadapter.py
index 686a636..88e7c37 100644
--- a/voltha/adapters/iadapter.py
+++ b/voltha/adapters/iadapter.py
@@ -188,6 +188,41 @@
def receive_onu_detect_state(self, proxy_address, state):
raise NotImplementedError()
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def create_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
"""
OLT Adapter base class
diff --git a/voltha/adapters/interface.py b/voltha/adapters/interface.py
index c2431fb..f8c6f28 100644
--- a/voltha/adapters/interface.py
+++ b/voltha/adapters/interface.py
@@ -305,18 +305,27 @@
"""
API to create various interfaces (only some PON interfaces as of now)
in the devices
+ :param device: device id
+ :data: interface data object
+ :return: None
"""
def update_interface(device, data):
"""
API to update various interfaces (only some PON interfaces as of now)
in the devices
+ :param device: device id
+ :data: interface data object
+ :return: None
"""
def remove_interface(device, data):
"""
API to delete various interfaces (only some PON interfaces as of now)
in the devices
+ :param device: device id
+ :data: interface data object
+ :return: None
"""
def receive_onu_detect_state(proxy_address, state):
@@ -327,6 +336,109 @@
:return: None
"""
+
+ def create_tcont(device, tcont_data, traffic_descriptor_data):
+ """
+ API to create tcont object in the devices
+ :param device: device id
+ :tcont_data: tcont data object
+ :traffic_descriptor_data: traffic descriptor data object
+ :return: None
+ """
+
+ def update_tcont(device, tcont_data, traffic_descriptor_data):
+ """
+ API to update tcont object in the devices
+ :param device: device id
+ :tcont_data: tcont data object
+ :traffic_descriptor_data: traffic descriptor data object
+ :return: None
+ """
+
+ def remove_tcont(device, tcont_data, traffic_descriptor_data):
+ """
+ API to delete tcont object in the devices
+ :param device: device id
+ :tcont_data: tcont data object
+ :traffic_descriptor_data: traffic descriptor data object
+ :return: None
+ """
+
+ def create_gemport(device, data):
+ """
+ API to create gemport object in the devices
+ :param device: device id
+ :data: gemport data object
+ :return: None
+ """
+
+ def update_gemport(device, data):
+ """
+ API to update gemport object in the devices
+ :param device: device id
+ :data: gemport data object
+ :return: None
+ """
+
+ def remove_gemport(device, data):
+ """
+ API to delete gemport object in the devices
+ :param device: device id
+ :data: gemport data object
+ :return: None
+ """
+
+ def create_multicast_gemport(device, data):
+ """
+ API to create multicast gemport object in the devices
+ :param device: device id
+ :data: multicast gemport data object
+ :return: None
+ """
+
+ def update_multicast_gemport(device, data):
+ """
+ API to update multicast gemport object in the devices
+ :param device: device id
+ :data: multicast gemport data object
+ :return: None
+ """
+
+ def remove_multicast_gemport(device, data):
+ """
+ API to delete multicast gemport object in the devices
+ :param device: device id
+ :data: multicast gemport data object
+ :return: None
+ """
+
+ def create_multicast_distribution_set(device, data):
+ """
+ API to create multicast distribution rule to specify
+ the multicast VLANs that ride on the multicast gemport
+ :param device: device id
+ :data: multicast distribution data object
+ :return: None
+ """
+
+ def update_multicast_distribution_set(device, data):
+ """
+ API to update multicast distribution rule to specify
+ the multicast VLANs that ride on the multicast gemport
+ :param device: device id
+ :data: multicast distribution data object
+ :return: None
+ """
+
+ def remove_multicast_distribution_set(device, data):
+ """
+ API to delete multicast distribution rule to specify
+ the multicast VLANs that ride on the multicast gemport
+ :param device: device id
+ :data: multicast distribution data object
+ :return: None
+ """
+
class IAdapterAgent(Interface):
"""
This object is passed in to the __init__ function of each adapter,
diff --git a/voltha/adapters/maple_olt/maple_olt.py b/voltha/adapters/maple_olt/maple_olt.py
index 03f7961..896b04f 100644
--- a/voltha/adapters/maple_olt/maple_olt.py
+++ b/voltha/adapters/maple_olt/maple_olt.py
@@ -521,6 +521,42 @@
def receive_onu_detect_state(self, device_id, state):
raise NotImplementedError()
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def create_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
def suppress_alarm(self, filter):
raise NotImplementedError()
diff --git a/voltha/adapters/microsemi_olt/microsemi_olt.py b/voltha/adapters/microsemi_olt/microsemi_olt.py
index a04a712..cf30317 100644
--- a/voltha/adapters/microsemi_olt/microsemi_olt.py
+++ b/voltha/adapters/microsemi_olt/microsemi_olt.py
@@ -169,6 +169,42 @@
def receive_onu_detect_state(self, device_id, state):
raise NotImplementedError()
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def create_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
def send_proxied_message(self, proxy_address, msg):
device = self.adaptor_agent.get_device(proxy_address.device_id)
_, _, comm = self.olts[device.mac_address]
diff --git a/voltha/adapters/pmcs_onu/pmcs_onu.py b/voltha/adapters/pmcs_onu/pmcs_onu.py
index aedbb99..0af00d9 100644
--- a/voltha/adapters/pmcs_onu/pmcs_onu.py
+++ b/voltha/adapters/pmcs_onu/pmcs_onu.py
@@ -184,6 +184,42 @@
def receive_inter_adapter_message(self, msg):
raise NotImplementedError()
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def create_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
def suppress_alarm(self, filter):
raise NotImplementedError()
diff --git a/voltha/adapters/ponsim_olt/ponsim_olt.py b/voltha/adapters/ponsim_olt/ponsim_olt.py
index aca7fc2..1e5d042 100644
--- a/voltha/adapters/ponsim_olt/ponsim_olt.py
+++ b/voltha/adapters/ponsim_olt/ponsim_olt.py
@@ -17,6 +17,7 @@
"""
Fully simulated OLT/ONU adapter.
"""
+import sys
from uuid import uuid4
import arrow
@@ -49,10 +50,18 @@
from voltha.registry import registry
from voltha.protos.bbf_fiber_base_pb2 import \
- ChannelgroupConfig, ChannelpartitionConfig, ChannelpairConfig, ChannelterminationConfig, \
- OntaniConfig, VOntaniConfig, VEnetConfig
+ ChannelgroupConfig, ChannelpartitionConfig, ChannelpairConfig,\
+ ChannelterminationConfig, OntaniConfig, VOntaniConfig, VEnetConfig
+from voltha.protos.bbf_fiber_traffic_descriptor_profile_body_pb2 import \
+ TrafficDescriptorProfileData
+from voltha.protos.bbf_fiber_tcont_body_pb2 import TcontsConfigData
+from voltha.protos.bbf_fiber_gemport_body_pb2 import GemportsConfigData
+from voltha.protos.bbf_fiber_multicast_gemport_body_pb2 import \
+ MulticastGemportsConfigData
+from voltha.protos.bbf_fiber_multicast_distribution_set_body_pb2 import \
+ MulticastDistributionSetData
-from voltha.protos.ponsim_pb2 import InterfaceConfig
+from voltha.protos.ponsim_pb2 import InterfaceConfig, TcontInterfaceConfig
_ = third_party
log = structlog.get_logger()
@@ -208,7 +217,109 @@
log.info('remove-interface', device_id=device.id)
self.devices_handlers[device.id].remove_interface(data)
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ log.info('create-tcont', device_id=device.id)
+ self.devices_handlers[device.id].create_tcont(tcont_data,
+ traffic_descriptor_data)
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ log.info('update-tcont', device_id=device.id)
+ self.devices_handlers[device.id].update_tcont(tcont_data,
+ traffic_descriptor_data)
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ log.info('remove-tcont', device_id=device.id)
+ self.devices_handlers[device.id].remove_tcont(tcont_data,
+ traffic_descriptor_data)
+
+ def create_gemport(self, device, data):
+ log.info('create-gemport', device_id=device.id)
+ self.devices_handlers[device.id].create_gemport(data)
+
+ def update_gemport(self, device, data):
+ log.info('update-gemport', device_id=device.id)
+ self.devices_handlers[device.id].update_gemport(data)
+
+ def remove_gemport(self, device, data):
+ log.info('remove-gemport', device_id=device.id)
+ self.devices_handlers[device.id].remove_gemport(data)
+
+ def create_multicast_gemport(self, device, data):
+ log.info('create-multicast-gemport', device_id=device.id)
+ self.devices_handlers[device.id].create_multicast_gemport(data)
+
+ def update_multicast_gemport(self, device, data):
+ log.info('update-multicast-gemport', device_id=device.id)
+ self.devices_handlers[device.id].update_multicast_gemport(data)
+
+ def remove_multicast_gemport(self, device, data):
+ log.info('remove-multicast-gemport', device_id=device.id)
+ self.devices_handlers[device.id].remove_multicast_gemport(data)
+
+ def create_multicast_distribution_set(self, device, data):
+ log.info('create-multicast-distribution-set', device_id=device.id)
+ self.devices_handlers[device.id].create_multicast_distribution_set(
+ data)
+
+ def update_multicast_distribution_set(self, device, data):
+ log.info('update-multicast-distribution-set', device_id=device.id)
+ self.devices_handlers[device.id].update_multicast_distribution_set(
+ data)
+
+ def remove_multicast_distribution_set(self, device, data):
+ log.info('remove-multicast-distribution-set', device_id=device.id)
+ self.devices_handlers[device.id].remove_multicast_distribution_set(
+ data)
+
class PonSimOltHandler(object):
+ xpon_ponsim_olt_itfs = {
+ 'create_interface': {
+ 'method_name': 'CreateInterface',
+ 'log': 'create-interface'},
+ 'update_interface': {
+ 'method_name': 'UpdateInterface',
+ 'log': 'update-interface'},
+ 'remove_interface': {
+ 'method_name': 'RemoveInterface',
+ 'log': 'remove-interface'},
+ 'create_tcont': {
+ 'method_name': 'CreateTcont',
+ 'log': 'create-tconts-config-data'},
+ 'update_tcont': {
+ 'method_name': 'UpdateTcont',
+ 'log': 'update-tconts-config-data'},
+ 'remove_tcont': {
+ 'method_name': 'RemoveTcont',
+ 'log': 'remove-tconts-config-data'},
+ 'create_gemport': {
+ 'method_name': 'CreateGemport',
+ 'log': 'create-gemports-config-data'},
+ 'update_gemport': {
+ 'method_name': 'UpdateGemport',
+ 'log': 'update-gemports-config-data'},
+ 'remove_gemport': {
+ 'method_name': 'RemoveGemport',
+ 'log': 'remove-gemports-config-data'},
+ 'create_multicast_gemport': {
+ 'method_name': 'CreateMulticastGemport',
+ 'log': 'create-multicast-gemports-config-data'},
+ 'update_multicast_gemport': {
+ 'method_name': 'UpdateMulticastGemport',
+ 'log': 'update-multicast-gemports-config-data'},
+ 'remove_multicast_gemport': {
+ 'method_name': 'RemoveMulticastGemport',
+ 'log': 'remove-multicast-gemports-config-data'},
+ 'create_multicast_distribution_set': {
+ 'method_name': 'CreateMulticastDistributionSet',
+ 'log': 'create-multicast-distribution-set-data'},
+ 'update_multicast_distribution_set': {
+ 'method_name': 'UpdateMulticastDistributionSet',
+ 'log': 'update-multicast-distribution-set-data'},
+ 'remove_multicast_distribution_set': {
+ 'method_name': 'RemoveMulticastDistributionSet',
+ 'log': 'remove-multicast-distribution-set-data'},
+ }
+
def __init__(self, adapter, device_id):
self.adapter = adapter
self.adapter_agent = adapter.adapter_agent
@@ -724,30 +835,100 @@
interfaceConfig.vont_ani_config.CopyFrom(data)
elif isinstance(data, VEnetConfig):
interfaceConfig.venet_config.CopyFrom(data)
+ elif isinstance(data, TrafficDescriptorProfileData):
+ interfaceConfig.traffic_descriptor_profile_config_data.CopyFrom(
+ data)
+ elif isinstance(data, TcontsConfigData):
+ interfaceConfig.tconts_config_data.CopyFrom(data)
+ elif isinstance(data, GemportsConfigData):
+ interfaceConfig.gemports_config_data.CopyFrom(data)
+ elif isinstance(data, MulticastGemportsConfigData):
+ interfaceConfig.multicast_gemports_config_data.CopyFrom(data)
+ elif isinstance(data, MulticastDistributionSetData):
+ interfaceConfig.multicast_distribution_set_data.CopyFrom(data)
else:
return None
return interfaceConfig
- def create_interface(self, data):
+ def xpon_ponsim_olt_interface(self, method_name, data, data2=None):
interfaceConfig = self.get_interface_config(data)
if interfaceConfig is not None:
- self.log.info('forwarding-create-interface-request-to-olt-for-interface-type', interface_type=type(data))
+ self.log.info(
+ 'forwarding-{}-request-to-olt-for-interface-type'
+ .format(self.xpon_ponsim_olt_itfs[method_name]['log']),
+ interface_type=type(data))
stub = ponsim_pb2.XPonSimStub(self.get_channel())
- stub.CreateInterface(interfaceConfig)
+ _method = getattr(
+ stub, self.xpon_ponsim_olt_itfs[method_name]['method_name'])
+ if isinstance(data, TcontsConfigData):
+ tcont_config = TcontInterfaceConfig()
+ tcont_config.tconts_config_data.CopyFrom(data)
+ tcont_config.traffic_descriptor_profile_config_data.CopyFrom(
+ data2)
+ _method(tcont_config)
+ else:
+ _method(interfaceConfig)
self.log.info('success')
+ def create_interface(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, data);
+
def update_interface(self, data):
- interfaceConfig = self.get_interface_config(data)
- if interfaceConfig is not None:
- self.log.info('forwarding-update-interface-request-to-olt-for-interface-type', interface_type=type(data))
- stub = ponsim_pb2.XPonSimStub(self.get_channel())
- stub.UpdateInterface(interfaceConfig)
- self.log.info('success')
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, data);
def remove_interface(self, data):
- interfaceConfig = self.get_interface_config(data)
- if interfaceConfig is not None:
- self.log.info('forwarding-remove-interface-request-to-olt-for-interface-type', interface_type=type(data))
- stub = ponsim_pb2.XPonSimStub(self.get_channel())
- stub.RemoveInterface(interfaceConfig)
- self.log.info('success')
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, data);
+
+ def create_tcont(self, tcont_data, traffic_descriptor_data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, tcont_data,
+ traffic_descriptor_data);
+
+ def update_tcont(self, tcont_data, traffic_descriptor_data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, tcont_data,
+ traffic_descriptor_data);
+
+ def remove_tcont(self, tcont_data, traffic_descriptor_data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, tcont_data,
+ traffic_descriptor_data);
+
+ def create_gemport(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, data);
+
+ def update_gemport(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, data);
+
+ def remove_gemport(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, data);
+
+ def create_multicast_gemport(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, data);
+
+ def update_multicast_gemport(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, data);
+
+ def remove_multicast_gemport(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, data);
+
+ def create_multicast_distribution_set(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, data);
+
+ def update_multicast_distribution_set(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, data);
+
+ def remove_multicast_distribution_set(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_olt_interface(_method_name, data);
diff --git a/voltha/adapters/ponsim_onu/ponsim_onu.py b/voltha/adapters/ponsim_onu/ponsim_onu.py
index 9d7175a..5467aad 100644
--- a/voltha/adapters/ponsim_onu/ponsim_onu.py
+++ b/voltha/adapters/ponsim_onu/ponsim_onu.py
@@ -18,6 +18,7 @@
Fully simulated OLT/ONU adapter.
"""
+import sys
import structlog
from twisted.internet.defer import DeferredQueue, inlineCallbacks
from common.utils.asleep import asleep
@@ -35,10 +36,50 @@
from voltha.protos.ponsim_pb2 import InterfaceConfig
from voltha.protos.bbf_fiber_base_pb2 import OntaniConfig, VOntaniConfig, \
VEnetConfig
+from voltha.protos.bbf_fiber_traffic_descriptor_profile_body_pb2 import \
+ TrafficDescriptorProfileData
+from voltha.protos.bbf_fiber_tcont_body_pb2 import TcontsConfigData
+from voltha.protos.bbf_fiber_gemport_body_pb2 import GemportsConfigData
+from voltha.protos.bbf_fiber_multicast_gemport_body_pb2 import \
+ MulticastGemportsConfigData
+from voltha.protos.bbf_fiber_multicast_distribution_set_body_pb2 import \
+ MulticastDistributionSetData
_ = third_party
log = structlog.get_logger()
+xpon_ponsim_onu_itfs = {
+ 'create_interface': {
+ 'log': 'create-interface'},
+ 'update_interface': {
+ 'log': 'update-interface'},
+ 'remove_interface': {
+ 'log': 'remove-interface'},
+ 'create_tcont': {
+ 'log': 'create-tconts-config-data'},
+ 'update_tcont': {
+ 'log': 'update-tconts-config-data'},
+ 'remove_tcont': {
+ 'log': 'remove-tconts-config-data'},
+ 'create_gemport': {
+ 'log': 'create-gemports-config-data'},
+ 'update_gemport': {
+ 'log': 'update-gemports-config-data'},
+ 'remove_gemport': {
+ 'log': 'remove-gemports-config-data'},
+ 'create_multicast_gemport': {
+ 'log': 'create-multicast-gemports-config-data'},
+ 'update_multicast_gemport': {
+ 'log': 'update-multicast-gemports-config-data'},
+ 'remove_multicast_gemport': {
+ 'log': 'remove-multicast-gemports-config-data'},
+ 'create_multicast_distribution_set': {
+ 'log': 'create-multicast-distribution-set-data'},
+ 'update_multicast_distribution_set': {
+ 'log': 'update-multicast-distribution-set-data'},
+ 'remove_multicast_distribution_set': {
+ 'log': 'remove-multicast-distribution-set-data'},
+ }
class PonSimOnuAdapter(OnuAdapter):
def __init__(self, adapter_agent, config):
@@ -53,26 +94,81 @@
device_type='ponsim_onu',
vendor_id='PSMO')
- def create_interface(self, device, data):
- log.info('create-interface', device_id=device.id)
+ def xpon_ponsim_onu_adapter_interface(self, method_name, device, data,
+ data2=None):
+ log.info('{}'.format(xpon_ponsim_onu_itfs[method_name]['log']),
+ device_id=device.id)
if device.id in self.devices_handlers:
handler = self.devices_handlers[device.id]
if handler is not None:
- handler.create_interface(data)
+ _method = getattr(handler, method_name)
+ if isinstance(data, TcontsConfigData):
+ _method(data, data2)
+ else:
+ _method(data)
+
+ def create_interface(self, device, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, data)
def update_interface(self, device, data):
- log.info('update-interface', device_id=device.id)
- if device.id in self.devices_handlers:
- handler = self.devices_handlers[device.id]
- if handler is not None:
- handler.update_interface(data)
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, data)
def remove_interface(self, device, data):
- log.info('remove-interface', device_id=device.id)
- if device.id in self.devices_handlers:
- handler = self.devices_handlers[device.id]
- if handler is not None:
- handler.remove_interface(data)
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, data)
+
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, tcont_data,
+ traffic_descriptor_data)
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, tcont_data,
+ traffic_descriptor_data)
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, tcont_data,
+ traffic_descriptor_data)
+
+ def create_gemport(self, device, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, data)
+
+ def update_gemport(self, device, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, data)
+
+ def remove_gemport(self, device, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, data)
+
+ def create_multicast_gemport(self, device, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, data)
+
+ def update_multicast_gemport(self, device, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, data)
+
+ def remove_multicast_gemport(self, device, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, data)
+
+ def create_multicast_distribution_set(self, device, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, data)
+
+ def update_multicast_distribution_set(self, device, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, data)
+
+ def remove_multicast_distribution_set(self, device, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_adapter_interface(_method_name, device, data)
class PonSimOnuHandler(object):
def __init__(self, adapter, device_id):
@@ -382,27 +478,89 @@
interfaceConfig.vont_ani_config.CopyFrom(data)
elif isinstance(data, VEnetConfig):
interfaceConfig.venet_config.CopyFrom(data)
+ elif isinstance(data, TrafficDescriptorProfileData):
+ interfaceConfig.traffic_descriptor_profile_config_data.CopyFrom(
+ data)
+ elif isinstance(data, TcontsConfigData):
+ interfaceConfig.tconts_config_data.CopyFrom(data)
+ elif isinstance(data, GemportsConfigData):
+ interfaceConfig.gemports_config_data.CopyFrom(data)
+ elif isinstance(data, MulticastGemportsConfigData):
+ interfaceConfig.multicast_gemports_config_data.CopyFrom(data)
+ elif isinstance(data, MulticastDistributionSetData):
+ interfaceConfig.multicast_distribution_set_data.CopyFrom(data)
else:
return None
return interfaceConfig
- def create_interface(self, data):
+ def xpon_ponsim_onu_interface (self, method_name, data, data2=None):
interfaceConfig = self.get_interface_config(data)
if interfaceConfig is not None:
- self.log.info(
- 'forwarding-create-interface-request-to-onu-for-intfc-type',
- interface_type=type(data))
+ self.log.info('forwarding-{}-request-to-onu-for-interface-type'
+ .format(xpon_ponsim_onu_itfs[method_name]['log']),
+ interface_type=type(data))
+ if data2 is not None:
+ self.log.info(interface_type=type(data2))
+
+ def create_interface(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, data)
def update_interface(self, data):
- interfaceConfig = self.get_interface_config(data)
- if interfaceConfig is not None:
- self.log.info(
- 'forwarding-update-interface-request-to-onu-for-intfc-type',
- interface_type=type(data))
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, data)
def remove_interface(self, data):
- interfaceConfig = self.get_interface_config(data)
- if interfaceConfig is not None:
- self.log.info(
- 'forwarding-remove-interface-request-to-onu-for-intfc-type',
- interface_type=type(data))
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, data)
+
+ def create_tcont(self, tcont_data, traffic_descriptor_data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, tcont_data,
+ traffic_descriptor_data)
+
+ def update_tcont(self, tcont_data, traffic_descriptor_data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, tcont_data,
+ traffic_descriptor_data)
+
+ def remove_tcont(self, tcont_data, traffic_descriptor_data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, tcont_data,
+ traffic_descriptor_data)
+
+ def create_gemport(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, data)
+
+ def update_gemport(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, data)
+
+ def remove_gemport(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, data)
+
+ def create_multicast_gemport(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, data)
+
+ def update_multicast_gemport(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, data)
+
+ def remove_multicast_gemport(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, data)
+
+ def create_multicast_distribution_set(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, data)
+
+ def update_multicast_distribution_set(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, data)
+
+ def remove_multicast_distribution_set(self, data):
+ _method_name = sys._getframe().f_code.co_name
+ self.xpon_ponsim_onu_interface(_method_name, data)
diff --git a/voltha/adapters/simulated_olt/simulated_olt.py b/voltha/adapters/simulated_olt/simulated_olt.py
index 0b6eb94..5e3aa97 100644
--- a/voltha/adapters/simulated_olt/simulated_olt.py
+++ b/voltha/adapters/simulated_olt/simulated_olt.py
@@ -902,6 +902,42 @@
def receive_onu_detect_state(self, device_id, state):
raise NotImplementedError()
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def create_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
# ~~~~~~~~~~~~~~~~~~~~ Embedded test Klein rest server ~~~~~~~~~~~~~~~~~~~~
def get_test_control_site(self):
diff --git a/voltha/adapters/simulated_onu/simulated_onu.py b/voltha/adapters/simulated_onu/simulated_onu.py
index c61ba8a..9cc0e87 100644
--- a/voltha/adapters/simulated_onu/simulated_onu.py
+++ b/voltha/adapters/simulated_onu/simulated_onu.py
@@ -414,6 +414,42 @@
def receive_onu_detect_state(self, device_id, state):
raise NotImplementedError()
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def create_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
def suppress_alarm(self, filter):
raise NotImplementedError()
diff --git a/voltha/adapters/tibit_olt/tibit_olt.py b/voltha/adapters/tibit_olt/tibit_olt.py
index da3269e..c2067b5 100644
--- a/voltha/adapters/tibit_olt/tibit_olt.py
+++ b/voltha/adapters/tibit_olt/tibit_olt.py
@@ -1498,3 +1498,39 @@
def receive_onu_detect_state(self, device_id, state):
raise NotImplementedError()
+
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def create_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
diff --git a/voltha/adapters/tibit_onu/tibit_onu.py b/voltha/adapters/tibit_onu/tibit_onu.py
index 137f572..5c52f18 100644
--- a/voltha/adapters/tibit_onu/tibit_onu.py
+++ b/voltha/adapters/tibit_onu/tibit_onu.py
@@ -670,6 +670,42 @@
def receive_onu_detect_state(self, device_id, state):
raise NotImplementedError()
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ raise NotImplementedError()
+
+ def create_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_gemport(self, device, data):
+ raise NotImplementedError()
+
+ def create_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def update_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
+ def remove_multicast_distribution_set(self, device, data):
+ raise NotImplementedError()
+
@inlineCallbacks
def _message_exchange(self, device):
diff --git a/voltha/core/adapter_agent.py b/voltha/core/adapter_agent.py
index 4c0b36c..c404de9 100644
--- a/voltha/core/adapter_agent.py
+++ b/voltha/core/adapter_agent.py
@@ -209,15 +209,53 @@
# def update_pm_collection(self, device, pm_collection_config):
# return self.adapter.update_pm_collection(device, pm_collection_config)
- def create_interface (self, device, data):
- return self.adapter.create_interface (device, data)
+ def create_interface(self, device, data):
+ return self.adapter.create_interface(device, data)
- def update_interface (self, device, data):
- return self.adapter.update_interface (device, data)
+ def update_interface(self, device, data):
+ return self.adapter.update_interface(device, data)
def remove_interface(self, device, data):
return self.adapter.remove_interface(device, data)
+ def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+ return self.adapter.create_tcont(device, tcont_data,
+ traffic_descriptor_data)
+
+ def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+ return self.adapter.update_tcont(device, tcont_data,
+ traffic_descriptor_data)
+
+ def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+ return self.adapter.remove_tcont(device, tcont_data,
+ traffic_descriptor_data)
+
+ def create_gemport(self, device, data):
+ return self.adapter.create_gemport(device, data)
+
+ def update_gemport(self, device, data):
+ return self.adapter.update_gemport(device, data)
+
+ def remove_gemport(self, device, data):
+ return self.adapter.remove_gemport(device, data)
+
+ def create_multicast_gemport(self, device, data):
+ return self.adapter.create_multicast_gemport(device, data)
+
+ def update_multicast_gemport(self, device, data):
+ return self.adapter.update_multicast_gemport(device, data)
+
+ def remove_multicast_gemport(self, device, data):
+ return self.adapter.remove_multicast_gemport(device, data)
+
+ def create_multicast_distribution_set(self, device, data):
+ return self.adapter.create_multicast_distribution_set(device, data)
+
+ def update_multicast_distribution_set(self, device, data):
+ return self.adapter.update_multicast_distribution_set(device, data)
+
+ def remove_multicast_distribution_set(self, device, data):
+ return self.adapter.remove_multicast_distribution_set(device, data)
# ~~~~~~~~~~~~~~~~~~~ Adapter-Facing Service ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/voltha/core/core.py b/voltha/core/core.py
index 7ddb5b8..ab8b157 100644
--- a/voltha/core/core.py
+++ b/voltha/core/core.py
@@ -36,8 +36,13 @@
from voltha.registry import IComponent
from xpon_agent import XponAgent
from xpon_handler import XponHandler
-from voltha.protos.bbf_fiber_base_pb2 import ChannelgroupConfig, ChannelpartitionConfig, \
- ChannelpairConfig, OntaniConfig, VOntaniConfig, VEnetConfig
+from voltha.protos.bbf_fiber_base_pb2 import ChannelgroupConfig, \
+ ChannelpartitionConfig, ChannelpairConfig, OntaniConfig, VOntaniConfig, \
+ VEnetConfig
+from voltha.protos.bbf_fiber_traffic_descriptor_profile_body_pb2 import \
+ TrafficDescriptorProfileData
+from voltha.protos.bbf_fiber_tcont_body_pb2 import TcontsConfigData
+from voltha.protos.bbf_fiber_gemport_body_pb2 import GemportsConfigData
log = structlog.get_logger()
@@ -159,7 +164,8 @@
self._handle_add_logical_device(data)
elif isinstance(data, (ChannelgroupConfig, ChannelpartitionConfig,
ChannelpairConfig, OntaniConfig, VOntaniConfig,
- VEnetConfig)):
+ VEnetConfig, TrafficDescriptorProfileData,
+ TcontsConfigData, GemportsConfigData)):
self.xpon_agent.create_interface(data)
elif isinstance(data, AlarmFilter):
self._handle_add_alarm_filter(data)
@@ -173,8 +179,9 @@
elif isinstance(data, LogicalDevice):
self._handle_remove_logical_device(data)
elif isinstance(data, (ChannelgroupConfig, ChannelpartitionConfig,
- ChannelpairConfig, OntaniConfig, VOntaniConfig,
- VEnetConfig)):
+ ChannelpairConfig, OntaniConfig, VOntaniConfig,
+ VEnetConfig, TrafficDescriptorProfileData,
+ TcontsConfigData, GemportsConfigData)):
self.xpon_agent.remove_interface(data)
elif isinstance(data, AlarmFilter):
self._handle_remove_alarm_filter(data)
diff --git a/voltha/core/local_handler.py b/voltha/core/local_handler.py
index a172e51..77d5204 100644
--- a/voltha/core/local_handler.py
+++ b/voltha/core/local_handler.py
@@ -900,51 +900,57 @@
@twisted_async
def GetAllTrafficDescriptorProfileData(self, request, context):
- return AllTrafficDescriptorProfileData()
+ return self.core.xpon_handler.get_all_traffic_descriptor_profile_data(
+ request, context)
@twisted_async
def CreateTrafficDescriptorProfileData(self, request, context):
- return Empty()
+ return self.core.xpon_handler.create_traffic_descriptor_profile(
+ request, context)
@twisted_async
def UpdateTrafficDescriptorProfileData(self, request, context):
- return Empty()
+ return self.core.xpon_handler.update_traffic_descriptor_profile(
+ request, context)
@twisted_async
def DeleteTrafficDescriptorProfileData(self, request, context):
- return Empty()
+ return self.core.xpon_handler.delete_traffic_descriptor_profile(
+ request, context)
@twisted_async
def GetAllTcontsConfigData(self, request, context):
- return AllTcontsConfigData()
+ return self.core.xpon_handler.get_all_tconts_config_data(
+ request, context)
@twisted_async
def CreateTcontsConfigData(self, request, context):
- return Empty()
+ return self.core.xpon_handler.create_tcont(request, context)
@twisted_async
def UpdateTcontsConfigData(self, request, context):
- return Empty()
+ return self.core.xpon_handler.update_tcont(request, context)
@twisted_async
def DeleteTcontsConfigData(self, request, context):
- return Empty()
+ return self.core.xpon_handler.delete_tcont(request, context)
@twisted_async
def GetAllGemportsConfigData(self, request, context):
- return AllGemportsConfigData()
+ return self.core.xpon_handler.get_all_gemports_config_data(
+ request, context)
@twisted_async
def CreateGemportsConfigData(self, request, context):
- return Empty()
+ return self.core.xpon_handler.create_gem_port(request, context)
@twisted_async
def UpdateGemportsConfigData(self, request, context):
- return Empty()
+ return self.core.xpon_handler.update_gem_port(request, context)
@twisted_async
def DeleteGemportsConfigData(self, request, context):
- return Empty()
+ return self.core.xpon_handler.delete_gem_port(request, context)
@twisted_async
def GetAllMulticastGemportsConfigData(self, request, context):
diff --git a/voltha/core/xpon_agent.py b/voltha/core/xpon_agent.py
index 3f8d94b..2dce5ea 100644
--- a/voltha/core/xpon_agent.py
+++ b/voltha/core/xpon_agent.py
@@ -21,7 +21,13 @@
from voltha.core.config.config_proxy import CallbackType
from voltha.protos.bbf_fiber_base_pb2 import ChannelgroupConfig, \
ChannelpartitionConfig, ChannelpairConfig, ChannelterminationConfig, \
- OntaniConfig, VOntaniConfig, VEnetConfig
+ OntaniConfig, VOntaniConfig, VEnetConfig, \
+ AllTrafficDescriptorProfileData, AllTcontsConfigData, AllGemportsConfigData
+from voltha.protos.bbf_fiber_traffic_descriptor_profile_body_pb2 import \
+ TrafficDescriptorProfileData
+from voltha.protos.bbf_fiber_tcont_body_pb2 import TcontsConfigData
+from voltha.protos.bbf_fiber_gemport_body_pb2 import GemportsConfigData
+
from voltha.protos.device_pb2 import Device
from voltha.protos.common_pb2 import AdminState
@@ -29,103 +35,102 @@
class XponAgent(object):
- interface_stack = {ChannelgroupConfig: {
- 'path': '/channel_groups/{}',
- 'path_keys': ['name'],
- 'parent': None, 'parent_path': None,
- 'parent_path_keys': [None],
- 'child': ChannelpartitionConfig,
- 'child_path': ['/channel_partitions'],
- 'olt_link': None, 'olt_link_path': None,
- 'olt_link_path_keys': [None],
- 'olt_device_id': 'from_child',
- 'onu_link': None, 'onu_link_path': None,
- 'onu_link_path_keys': [None],
- 'onu_device_id': 'na'},
- ChannelpartitionConfig: {
- 'path': '/channel_partitions/{}',
- 'path_keys': ['name'],
- 'parent': ChannelgroupConfig,
- 'parent_path': '/channel_groups/{}',
- 'parent_path_keys': ['data.channelgroup_ref'],
- 'child': ChannelpairConfig,
- 'child_path': ['/channel_pairs'],
- 'olt_link': None, 'olt_link_path': None,
- 'olt_link_path_keys': [None],
- 'olt_device_id': 'from_child',
- 'onu_link': None, 'onu_link_path': None,
- 'onu_link_path_keys': [None],
- 'onu_device_id': 'na'},
- ChannelpairConfig: {
- 'path': '/channel_pairs/{}', 'path_keys': ['name'],
- 'parent': ChannelpartitionConfig,
- 'parent_path': '/channel_partitions/{}',
- 'parent_path_keys':\
- ['data.channelpartition_ref'],
- 'child': ChannelterminationConfig,
- 'child_path':\
- ['/devices', 'channel_terminations'],
- 'olt_link': None, 'olt_link_path': None,
- 'olt_link_path_keys': [None],
- 'olt_device_id': 'from_child',
- 'onu_link': None,
- 'onu_link_path': None,
- 'onu_link_path_keys': [None],
- 'onu_device_id': 'na'},
- ChannelterminationConfig: {
- 'path': '/devices/{}/channel_terminations/{}',
- 'path_keys': ['id', 'name'],
- 'parent': ChannelpairConfig,
- 'parent_path': '/channel_pairs/{}',
- 'parent_path_keys':\
- ['data.channelpair_ref'],
- 'child': None, 'child_path': [None],
- 'olt_link': None, 'olt_link_path': None,
- 'olt_link_path_keys': [None],
- 'olt_device_id': 'self',
- 'onu_link': None, 'onu_link_path': None,
- 'onu_link_path_keys': [None],
- 'onu_device_id': 'na'},
- VOntaniConfig: {
- 'path': '/v_ont_anis/{}', 'path_keys': ['name'],
- 'parent': ChannelpartitionConfig,
- 'parent_path': '/channel_partitions/{}',
- 'parent_path_keys': ['data.parent_ref'],
- 'child': VEnetConfig, 'child_path': ['/v_enets'],
- 'olt_link': ChannelpairConfig,
- 'olt_link_path': '/channel_pairs/{}',
- 'olt_link_path_keys':\
- ['data.preferred_chanpair'],
- 'olt_device_id': 'from_link',
- 'onu_link': None, 'onu_link_path': None,
- 'onu_link_path_keys': [None],
- 'onu_device_id': 'self'},
- OntaniConfig: {
- 'path': '/ont_anis/{}', 'path_keys': ['name'],
- 'parent': None, 'parent_path': None,
- 'parent_path_keys': [None],
- 'child': None, 'child_path': [None],
- 'olt_link': VOntaniConfig,
- 'olt_link_path': '/v_ont_anis/{}',
- 'olt_link_path_keys': ['name'],
- 'olt_device_id' : 'from_link',
- 'onu_link': VOntaniConfig,
- 'onu_link_path': '/v_ont_anis/{}',
- 'onu_link_path_keys': ['name'],
- 'onu_device_id': 'from_link'},
- VEnetConfig: {
- 'path': '/v_enets/{}', 'path_keys': ['name'],
- 'parent': VOntaniConfig,
- 'parent_path': '/v_ont_anis/{}',
- 'parent_path_keys': ['data.v_ontani_ref'],
- 'child': None, 'child_path': [None],
- 'olt_link': None, 'olt_link_path': None,
- 'olt_link_path_keys': [None],
- 'olt_device_id': 'from_parent',
- 'onu_link': None, 'onu_link_path': None,
- 'onu_link_path_keys': [None],
- 'onu_device_id': 'from_parent'}
- }
+ interface_stack = {
+ ChannelgroupConfig: {
+ 'path': '/channel_groups/{}', 'path_keys': ['name'],
+ 'parent': None, 'parent_path': None, 'parent_path_keys': [None],
+ 'child': {
+ 1: {'config': ChannelpartitionConfig,
+ 'child_path': ['/channel_partitions']}},
+ 'olt_link': None, 'olt_link_path': None,
+ 'olt_link_path_keys': [None], 'olt_device_id': 'from_child',
+ 'onu_link': None, 'onu_link_path': None,
+ 'onu_link_path_keys': [None], 'onu_device_id': 'na'},
+ ChannelpartitionConfig: {
+ 'path': '/channel_partitions/{}', 'path_keys': ['name'],
+ 'parent': ChannelgroupConfig, 'parent_path': '/channel_groups/{}',
+ 'parent_path_keys': ['data.channelgroup_ref'],
+ 'child': {
+ 1: {'config': ChannelpairConfig,
+ 'child_path': ['/channel_pairs']}},
+ 'olt_link': None, 'olt_link_path': None,
+ 'olt_link_path_keys': [None], 'olt_device_id': 'from_child',
+ 'onu_link': None, 'onu_link_path': None,
+ 'onu_link_path_keys': [None], 'onu_device_id': 'na'},
+ ChannelpairConfig: {
+ 'path': '/channel_pairs/{}', 'path_keys': ['name'],
+ 'parent': ChannelpartitionConfig,
+ 'parent_path': '/channel_partitions/{}',
+ 'parent_path_keys': ['data.channelpartition_ref'],
+ 'child': {
+ 1: {'config': ChannelterminationConfig,
+ 'child_path': ['/devices', 'channel_terminations']}},
+ 'olt_link': None, 'olt_link_path': None,
+ 'olt_link_path_keys': [None], 'olt_device_id': 'from_child',
+ 'onu_link': None, 'onu_link_path': None,
+ 'onu_link_path_keys': [None], 'onu_device_id': 'na'},
+ ChannelterminationConfig: {
+ 'path': '/devices/{}/channel_terminations/{}',
+ 'path_keys': ['id', 'name'],
+ 'parent': ChannelpairConfig, 'parent_path': '/channel_pairs/{}',
+ 'parent_path_keys': ['data.channelpair_ref'],
+ 'child': None, 'child_path': [None],
+ 'olt_link': None, 'olt_link_path': None,
+ 'olt_link_path_keys': [None], 'olt_device_id': 'self',
+ 'onu_link': None, 'onu_link_path': None,
+ 'onu_link_path_keys': [None], 'onu_device_id': 'na'},
+ VOntaniConfig: {
+ 'path': '/v_ont_anis/{}', 'path_keys': ['name'],
+ 'parent': ChannelpartitionConfig,
+ 'parent_path': '/channel_partitions/{}',
+ 'parent_path_keys': ['data.parent_ref'],
+ 'child': {
+ 1: {'config': VEnetConfig, 'child_path': ['/v_enets']},
+ 2: {'config': TcontsConfigData, 'child_path': ['/tconts']}},
+ 'olt_link': ChannelpairConfig,
+ 'olt_link_path': '/channel_pairs/{}',
+ 'olt_link_path_keys': ['data.preferred_chanpair'],
+ 'olt_device_id': 'from_link',
+ 'onu_link': None, 'onu_link_path': None,
+ 'onu_link_path_keys': [None], 'onu_device_id': 'self'},
+ OntaniConfig: {
+ 'path': '/ont_anis/{}', 'path_keys': ['name'],
+ 'parent': None, 'parent_path': None, 'parent_path_keys': [None],
+ 'child': None, 'child_path': [None],
+ 'olt_link': VOntaniConfig, 'olt_link_path': '/v_ont_anis/{}',
+ 'olt_link_path_keys': ['name'], 'olt_device_id' : 'from_link',
+ 'onu_link': VOntaniConfig, 'onu_link_path': '/v_ont_anis/{}',
+ 'onu_link_path_keys': ['name'], 'onu_device_id': 'from_link'},
+ VEnetConfig: {
+ 'path': '/v_enets/{}', 'path_keys': ['name'],
+ 'parent': VOntaniConfig, 'parent_path': '/v_ont_anis/{}',
+ 'parent_path_keys': ['data.v_ontani_ref'],
+ 'child': {
+ 1: {'config': GemportsConfigData,
+ 'child_path': ['/gemports']}},
+ 'olt_link': None, 'olt_link_path': None,
+ 'olt_link_path_keys': [None], 'olt_device_id': 'from_parent',
+ 'onu_link': None, 'onu_link_path': None,
+ 'onu_link_path_keys': [None], 'onu_device_id': 'from_parent'},
+ TcontsConfigData: {
+ 'path': '/tconts/{}', 'path_keys': ['name'],
+ 'parent': VOntaniConfig, 'parent_path': '/v_ont_anis/{}',
+ 'parent_path_keys': ['interface_reference'],
+ 'child': None, 'child_path': [None],
+ 'olt_link': None, 'olt_link_path': None,
+ 'olt_link_path_keys': [None], 'olt_device_id': 'from_parent',
+ 'onu_link': None, 'onu_link_path': None,
+ 'onu_link_path_keys': [None], 'onu_device_id': 'from_parent'},
+ GemportsConfigData: {
+ 'path': '/gemports/{}', 'path_keys': ['name'],
+ 'parent': VEnetConfig, 'parent_path': '/v_enets/{}',
+ 'parent_path_keys': ['itf_ref'],
+ 'child': None, 'child_path': [None],
+ 'olt_link': None, 'olt_link_path': None,
+ 'olt_link_path_keys': [None], 'olt_device_id': 'from_parent',
+ 'onu_link': None, 'onu_link_path': None,
+ 'onu_link_path_keys': [None], 'onu_device_id': 'from_parent'}
+ }
def __init__(self, core):
self.core = core
@@ -210,18 +215,18 @@
def get_child_data(self, data):
interface_node = self.interface_stack[type(data)]
- if len(interface_node['child_path']) > 1:
+ if len(interface_node['child'][1]['child_path']) > 1:
top_children = self.core.get_proxy('/').get('{}'.format(
- interface_node['child_path'][0]))
+ interface_node['child'][1]['child_path'][0]))
for top_child in top_children:
child = self._get_child_data_by_path(data, '{}/{}/{}'.format(
- interface_node['child_path'][0], top_child.id,
- interface_node['child_path'][1]))
+ interface_node['child'][1]['child_path'][0], top_child.id,
+ interface_node['child'][1]['child_path'][1]))
if child is not None:
return child
else:
child = self._get_child_data_by_path(data, '{}'.format(
- interface_node['child_path'][0]))
+ interface_node['child'][1]['child_path'][0]))
if child is None:
log.info('xpon-agent-warning-interface-cannot-get-child',
data=data)
@@ -295,26 +300,92 @@
def create_interface_in_device(self, device, data):
adapter_agent = self.get_device_adapter_agent(device)
- adapter_agent.create_interface(device=device, data=data)
+ if (isinstance(data, TcontsConfigData)):
+ # Adapter interfaces for TCONT always need traffic-descriptor
+ traffic_descriptor_data = self.core.get_proxy('/').get(
+ '/traffic_descriptor_profiles/{}'.
+ format(data.traffic_descriptor_profile_ref))
+ adapter_agent.create_tcont(
+ device=device, tcont_data=data,
+ traffic_descriptor_data=traffic_descriptor_data)
+ elif (isinstance(data, TrafficDescriptorProfileData)):
+ # Do nothing for now
+ log.info(
+ 'create-interface-in-device-traffic-descriptor-do-nothing',
+ device=device, data=data)
+ elif (isinstance(data, GemportsConfigData)):
+ adapter_agent.create_gemport(device=device, data=data)
+ elif (isinstance(data, (ChannelgroupConfig, ChannelpartitionConfig,
+ ChannelpairConfig, ChannelterminationConfig,
+ OntaniConfig, VOntaniConfig, VEnetConfig))):
+ adapter_agent.create_interface(device=device, data=data)
+ else:
+ # Not handled yet
+ log.info('create-interface-in-device: Not handling',
+ device=device, data=data)
def update_interface_in_device(self, device, data):
adapter_agent = self.get_device_adapter_agent(device)
- adapter_agent.update_interface(device=device, data=data)
+ if (isinstance(data, TcontsConfigData)):
+ # Adapter interfaces for TCONT always need traffic-descriptor
+ traffic_descriptor_data = self.core.get_proxy('/').get(
+ '/traffic_descriptor_profiles/{}'.
+ format(data.traffic_descriptor_profile_ref))
+ adapter_agent.update_tcont(
+ device=device, tcont_data=data,
+ traffic_descriptor_data=traffic_descriptor_data)
+ elif (isinstance(data, TrafficDescriptorProfileData)):
+ # Do nothing for now
+ log.info(
+ 'update-interface-in-device-traffic-descriptor-do-nothing',
+ device=device, data=data)
+ elif (isinstance(data, GemportsConfigData)):
+ adapter_agent.update_gemport(device=device, data=data)
+ elif (isinstance(data, (ChannelgroupConfig, ChannelpartitionConfig,
+ ChannelpairConfig, ChannelterminationConfig,
+ OntaniConfig, VOntaniConfig, VEnetConfig))):
+ adapter_agent.update_interface(device=device, data=data)
+ else:
+ # Not handled yet
+ log.info('create-interface-in-device: Not handling',
+ device=device, data=data)
def remove_interface_in_device(self, device, data):
adapter_agent = self.get_device_adapter_agent(device)
- adapter_agent.remove_interface(device=device, data=data)
+ if (isinstance(data, TcontsConfigData)):
+ # Adapter interfaces for TCONT always need traffic-descriptor
+ traffic_descriptor_data = self.core.get_proxy('/').get(
+ '/traffic_descriptor_profiles/{}'.
+ format(data.traffic_descriptor_profile_ref))
+ adapter_agent.remove_tcont(
+ device=device, tcont_data=data,
+ traffic_descriptor_data=traffic_descriptor_data)
+ elif (isinstance(data, TrafficDescriptorProfileData)):
+ # Do nothing for now
+ log.info(
+ 'remove-interface-in-device-traffic-descriptor-do-nothing',
+ device=device, data=data)
+ elif (isinstance(data, GemportsConfigData)):
+ adapter_agent.remove_gemport(device=device, data=data)
+ elif (isinstance(data, (ChannelgroupConfig, ChannelpartitionConfig,
+ ChannelpairConfig, ChannelterminationConfig,
+ OntaniConfig, VOntaniConfig, VEnetConfig))):
+ adapter_agent.remove_interface(device=device, data=data)
+ else:
+ # Not handled yet
+ log.info('remove-interface-in-device: Not handling',
+ device=device, data=data)
def create_interface(self, data, device_id=None):
+ if not self.is_valid_interface(data):
+ log.info('xpon-agent-create-interface-invalid-interface-type',
+ type=type(data).__name__)
+ return
if device_id is None:
olt_device = self.get_device(data, 'olt')
else:
olt_device = self.core.get_proxy('/').get('/devices/{}'.
format(device_id))
- if not self.is_valid_interface(data):
- log.info('xpon-agent-create-interface-invalid-interface-type',
- type=type(data).__name__)
- return
device_id = None if olt_device is None else olt_device.id
self.register_interface(device_id=device_id,
path=self.get_interface_path(data))
@@ -358,15 +429,15 @@
self.update_interface_in_device(onu_device, data)
def remove_interface(self, data, device_id=None):
+ if not self.is_valid_interface(data):
+ log.info('xpon-agent-remove-interface-invalid-interface-type',
+ type=type(data).__name__)
+ return
if device_id is None:
olt_device = self.get_device(data, 'olt')
else:
olt_device = self.core.get_proxy('/').get('/devices/{}'.
format(device_id))
- if not self.is_valid_interface(data):
- log.info('xpon-agent-remove-interface-invalid-interface-type',
- type=type(data).__name__)
- return
if olt_device is not None:
log.info('xpon-agent-remove-interface:',
olt_device_id=olt_device.id, data=data)
@@ -448,6 +519,11 @@
'xpon-agent-creating-v-enet-at-onu-device:',
onu_device_id=onu_device.id, v_enet=v_enet)
self.create_interface_in_device(onu_device, v_enet)
+ '''
+ @TODO: Add creation of Traffic Descriptor Profile, TCont, and
+ Gemport. Creation of all interfaces must be remodeled
+ utilizing interface stack's parent-child relationship.
+ '''
except KeyError:
log.info(
'xpon-agent-create-onu-interfaces-no-ont-ani-link-exists')
@@ -487,6 +563,11 @@
for v_ont_ani in v_ont_anis:
if self.get_link_data(v_ont_ani, 'olt').name == data.name:
onu_device = self.get_device(v_ont_ani, 'onu')
+ '''
+ @TODO: Add remove of Traffic Descriptor Profile, TCont, and
+ Gemport. Remove of all interfaces must be remodeled
+ utilizing interface stack's parent-child relationship.
+ '''
v_enets = self.core.get_proxy('/').get('/v_enets')
for v_enet in v_enets:
if self.get_parent_data(v_enet).name == v_ont_ani.name:
diff --git a/voltha/core/xpon_handler.py b/voltha/core/xpon_handler.py
index 17408e9..674b888 100644
--- a/voltha/core/xpon_handler.py
+++ b/voltha/core/xpon_handler.py
@@ -27,7 +27,12 @@
AllChannelpartitionConfig, ChannelpartitionConfig, \
AllChannelterminationConfig, ChannelterminationConfig, \
AllOntaniConfig, OntaniConfig, AllVOntaniConfig , VOntaniConfig, \
- AllVEnetConfig, VEnetConfig
+ AllVEnetConfig, VEnetConfig, AllTrafficDescriptorProfileData, \
+ AllTcontsConfigData, AllGemportsConfigData
+from voltha.protos.bbf_fiber_traffic_descriptor_profile_body_pb2 import \
+ TrafficDescriptorProfileData
+from voltha.protos.bbf_fiber_tcont_body_pb2 import TcontsConfigData
+from voltha.protos.bbf_fiber_gemport_body_pb2 import GemportsConfigData
from voltha.protos.device_pb2 import Device
from voltha.protos.common_pb2 import AdminState
@@ -138,34 +143,33 @@
return Empty()
try:
- assert isinstance(request, ChannelgroupConfig)
- known_channel_group_ref = dict(
- (dt.data.channelgroup_ref, dt) for dt in self.root.get(
- '/channel_partitions'))
- known_channel_group_ref_1 = dict(
- (dt.data.channelgroup_ref, dt) for dt in self.root.get(
- '/channel_pairs'))
- reference = "channel partition"
- assert request.name not in known_channel_group_ref
- reference = "channel pair"
- assert request.name not in known_channel_group_ref_1
+ assert isinstance(request, ChannelgroupConfig), \
+ 'Instance is not of Channel Group'
+ channelgroup_ref_by_channelpartition = next(
+ (cpart for cpart in self.root.get('/channel_partitions')
+ if cpart.data.channelgroup_ref == request.name), None)
+ assert channelgroup_ref_by_channelpartition is None, \
+ 'Channel Group -- \'{}\' is referenced by Channel Partition'\
+ .format(request.name)
+ channelgroup_ref_by_channelpair = next(
+ (cpair for cpair in self.root.get('/channel_pairs')
+ if cpair.data.channelgroup_ref == request.name), None)
+ assert channelgroup_ref_by_channelpair is None, \
+ 'Channel Group -- \'{}\' is referenced by Channel Pair'\
+ .format(request.name)
channelgroup = self.get_channel_group_config(request, context)
- assert channelgroup.name == request.name
-
+ assert channelgroup.name == request.name, \
+ 'Unable to find specified Channel Group -- \'{}\''\
+ .format(request.name)
path = '/channel_groups/{}'.format(request.name)
log.debug('removing-channel-group', name=request.name)
self.root.remove(path)
- self.cg_pool.release(channelgroup.cg_index)
-
+ self.cg_pool.release(channelgroup.cg_index)
return Empty()
-
- except AssertionError:
- context.set_details(
- 'The channel group -- \'{}\' is referenced by {}'.format(
- request.name, reference))
+ except AssertionError, e:
+ context.set_details(e.message)
context.set_code(StatusCode.INVALID_ARGUMENT)
return Empty()
-
except KeyError:
context.set_details(
'channel group \'{}\' not found'.format(request.name))
@@ -233,30 +237,28 @@
return Empty()
try:
- assert isinstance(request, ChannelpartitionConfig)
- known_channel_partition_ref = dict(
- (dt.data.channelpartition_ref, dt) for dt in self.root.get(
- '/channel_pairs'))
- known_channel_partition_ref_1 = dict(
- (dt.data.parent_ref, dt) for dt in self.root.get(
- '/v_ont_anis'))
- reference = "channel pair"
- assert request.name not in known_channel_partition_ref
- reference = "vontani"
- assert request.name not in known_channel_partition_ref_1
+ assert isinstance(request, ChannelpartitionConfig), \
+ 'Instance is not of Channel Partition'
+ channelpartition_ref_by_channelpair = next(
+ (cpair for cpair in self.root.get('/channel_pairs')
+ if cpair.data.channelpartition_ref == request.name), None)
+ assert channelpartition_ref_by_channelpair is None, \
+ 'Channel Partition -- \'{}\' is referenced by Channel Pair'\
+ .format(request.name)
+ channelpartition_ref_by_vontani = next(
+ (vont_ani for vont_ani in self.root.get('/v_ont_anis')
+ if vont_ani.data.parent_ref == request.name), None)
+ assert channelpartition_ref_by_vontani is None, \
+ 'Channel Partition -- \'{}\' is referenced by VOntAni'\
+ .format(request.name)
path = '/channel_partitions/{}'.format(request.name)
log.debug('removing-channel-partition', name=request.name)
self.root.remove(path)
-
return Empty()
-
- except AssertionError:
- context.set_details(
- 'The channel partition -- \'{}\' is referenced by {}'.format(
- request.name, reference))
+ except AssertionError, e:
+ context.set_details(e.message)
context.set_code(StatusCode.INVALID_ARGUMENT)
return Empty()
-
except KeyError:
context.set_details(
'channel partition \'{}\' not found'.format(request.name))
@@ -324,27 +326,26 @@
return Empty()
try:
- assert isinstance(request, ChannelpairConfig)
+ assert isinstance(request, ChannelpairConfig), \
+ 'Instance is not of Channel Pair'
device_items = self.root.get('/devices')
for device_item in device_items:
- known_channel_pair_ref = dict(
- (dt.data.channelpair_ref, dt) for dt in self.root.get(
+ channelpair_ref_by_channeltermination = next(
+ (cterm for cterm in self.root.get(
'/devices/{}/channel_terminations'.format(
- device_item.id)))
- assert request.name not in known_channel_pair_ref
+ device_item.id))
+ if cterm.data.channelpair_ref == request.name), None)
+ assert channelpair_ref_by_channeltermination is None, \
+ 'Channel Pair -- \'{}\' referenced by Channel Termination'\
+ .format(request.name)
path = '/channel_pairs/{}'.format(request.name)
log.debug('removing-channel-pair', name=request.name)
self.root.remove(path)
-
return Empty()
-
- except AssertionError:
- context.set_details(
- 'The ch pair -- \'{}\' is referenced by ch termination'.
- format(request.name))
+ except AssertionError, e:
+ context.set_details(e.message)
context.set_code(StatusCode.INVALID_ARGUMENT)
return Empty()
-
except KeyError:
context.set_details(
'channel pair \'{}\' not found'.format(request.name))
@@ -627,26 +628,29 @@
'Malformed name \'{}\''.format(request.name))
context.set_code(StatusCode.INVALID_ARGUMENT)
return Empty()
-
try:
- assert isinstance(request, VOntaniConfig)
- known_v_ont_ani_ref = dict(
- (dt.data.v_ontani_ref, dt) for dt in self.root.get('/v_enets'))
- assert request.name not in known_v_ont_ani_ref
-
+ assert isinstance(request, VOntaniConfig), \
+ 'Instance is not of vont ani'
+ vontani_ref_by_venet = next(
+ (venet for venet in self.root.get('/v_enets')
+ if venet.data.v_ontani_ref == request.name), None)
+ assert vontani_ref_by_venet is None, \
+ 'VOntAni -- \'{}\' is referenced by VEnet'.format(
+ request.name)
+ vontani_ref_by_tcont = next(
+ (tcont for tcont in self.root.get('/tconts')
+ if tcont.interface_reference == request.name), None)
+ assert vontani_ref_by_tcont is None, \
+ 'VOntAni -- \'{}\' is referenced by TCont'.format(
+ request.name)
path = '/v_ont_anis/{}'.format(request.name)
log.debug('removing-vont-ani', name=request.name)
self.root.remove(path)
-
return Empty()
-
- except AssertionError:
- context.set_details(
- 'The vont ani -- \'{}\' is referenced by venet'.format(
- request.name))
+ except AssertionError, e:
+ context.set_details(e.message)
context.set_code(StatusCode.INVALID_ARGUMENT)
return Empty()
-
except KeyError:
context.set_details(
'vontani \'{}\' not found'.format(request.name))
@@ -718,18 +722,24 @@
return Empty()
try:
- assert isinstance(request, VEnetConfig)
+ assert isinstance(request, VEnetConfig), \
+ 'Instance is not of VEnet'
#assert device.admin_state == AdminState.DISABLED, \
#'Device to delete cannot be ' \
#'in admin state \'{}\''.format(device.admin_state)
+ v_enet_ref_by_gemport = next(
+ (gemport for gemport in self.root.get('/gemports')
+ if gemport.itf_ref == request.name), None)
+ assert v_enet_ref_by_gemport is None, \
+ 'The VEnet -- \'{}\' is referenced by Gemport'.format(
+ request.name)
path = '/v_enets/{}'.format(request.name)
log.debug('removing-venet', name=request.name)
self.root.remove(path)
return Empty()
- except AssertionError:
- context.set_details(
- 'Instance is not of venet')
+ except AssertionError, e:
+ context.set_details(e.message)
context.set_code(StatusCode.INVALID_ARGUMENT)
return Empty()
@@ -739,6 +749,257 @@
context.set_code(StatusCode.NOT_FOUND)
return Empty()
+ def get_all_traffic_descriptor_profile_data(self, request, context):
+ log.info('grpc-request', request=request)
+ items = self.root.get('/traffic_descriptor_profiles')
+ return AllTrafficDescriptorProfileData(
+ traffic_descriptor_profiles=items)
+
+ def create_traffic_descriptor_profile(self, request, context):
+ log.info('grpc-request', request=request)
+ try:
+ assert isinstance(request, TrafficDescriptorProfileData)
+ assert self.validate_interface(request, context)
+ log.debug('creating-traffic-descriptor-profile', name=request.name)
+ self.root.add('/traffic_descriptor_profiles', request)
+ return Empty()
+ except AssertionError, e:
+ return Empty()
+ except KeyError:
+ context.set_details(
+ 'Cannot create traffic descriptor profile \'{}\''.format(
+ request.name))
+ context.set_code(StatusCode.NOT_FOUND)
+ return Empty()
+ except ValueError:
+ context.set_details(
+ 'Duplicated traffic descriptor profile \'{}\' \
+ cannot be created'.format(request.name))
+ context.set_code(StatusCode.INVALID_ARGUMENT)
+ return Empty()
+
+ def update_traffic_descriptor_profile(self, request, context):
+ log.info('grpc-request', request=request)
+
+ if '/' in request.name:
+ context.set_details(
+ 'Malformed name \'{}\''.format(request.name))
+ context.set_code(StatusCode.INVALID_ARGUMENT)
+ return TrafficDescriptorProfileData()
+
+ try:
+ assert isinstance(request, TrafficDescriptorProfileData)
+ assert self.validate_interface(request, context)
+
+ path = '/traffic_descriptor_profiles/{}'.format(request.name)
+ log.debug('updating-traffic-descriptor-profile',
+ name=request.name)
+ self.root.update(path, request, strict=True)
+ return Empty()
+
+ except AssertionError, e:
+ return Empty()
+
+ except KeyError:
+ context.set_details(
+ 'traffic descriptor profile \'{}\' not found'.format(
+ request.name))
+ context.set_code(StatusCode.NOT_FOUND)
+ return Empty()
+
+ def delete_traffic_descriptor_profile(self, request, context):
+ log.info('grpc-request', request=request)
+
+ if '/' in request.name:
+ context.set_details(
+ 'Malformed name \'{}\''.format(request.name))
+ context.set_code(StatusCode.INVALID_ARGUMENT)
+ return Empty()
+
+ try:
+ assert isinstance(request, TrafficDescriptorProfileData), \
+ 'Instance is not of Traffic Descriptor Profile Data'
+ tdp_ref_by_tcont = next(
+ (tcont for tcont in self.root.get('/tconts') if
+ tcont.traffic_descriptor_profile_ref == request.name), None)
+ assert tdp_ref_by_tcont is None, \
+ 'The Traffic Descriptor Profile -- \'{}\' is referenced \
+ by TCont'.format(request.name)
+ path = '/traffic_descriptor_profiles/{}'.format(request.name)
+ log.debug('removing-traffic-descriptor-profile',
+ name=request.name)
+ self.root.remove(path)
+ return Empty()
+ except AssertionError, e:
+ context.set_details(e.message)
+ context.set_code(StatusCode.INVALID_ARGUMENT)
+ return Empty()
+ except KeyError:
+ context.set_details(
+ 'traffic descriptor profile \'{}\' not found'.format(
+ request.name))
+ context.set_code(StatusCode.NOT_FOUND)
+ return Empty()
+
+ def get_all_tconts_config_data(self, request, context):
+ log.info('grpc-request', request=request)
+ items = self.root.get('/tconts')
+ return AllTcontsConfigData(tconts_config=items)
+
+ def create_tcont(self, request, context):
+ log.info('grpc-request', request=request)
+ try:
+ assert isinstance(request, TcontsConfigData)
+ assert self.validate_interface(request, context)
+ '''
+ @TODO: Allocation of Alloc-ID
+ '''
+ log.debug('creating-tcont', name=request.name)
+ self.root.add('/tconts', request)
+ return Empty()
+ except AssertionError, e:
+ return Empty()
+ except KeyError:
+ context.set_details(
+ 'Cannot create tcont \'{}\''.format(request.name))
+ context.set_code(StatusCode.NOT_FOUND)
+ return Empty()
+ except ValueError:
+ context.set_details(
+ 'Duplicated tcont \'{}\' cannot be created'.format(
+ request.name))
+ context.set_code(StatusCode.INVALID_ARGUMENT)
+ return Empty()
+
+ def update_tcont(self, request, context):
+ log.info('grpc-request', request=request)
+ if '/' in request.name:
+ context.set_details(
+ 'Malformed name \'{}\''.format(request.name))
+ context.set_code(StatusCode.INVALID_ARGUMENT)
+ return TcontsConfigData()
+ try:
+ assert isinstance(request, TcontsConfigData)
+ assert self.validate_interface(request, context)
+
+ path = '/tconts/{}'.format(request.name)
+ log.debug('updating-tcont', name=request.name)
+ self.root.update(path, request, strict=True)
+ return Empty()
+ except AssertionError, e:
+ return Empty()
+ except KeyError:
+ context.set_details(
+ 'tcont \'{}\' not found'.format(request.name))
+ context.set_code(StatusCode.NOT_FOUND)
+ return Empty()
+
+ def delete_tcont(self, request, context):
+ log.info('grpc-request', request=request)
+ if '/' in request.name:
+ context.set_details(
+ 'Malformed name \'{}\''.format(request.name))
+ context.set_code(StatusCode.INVALID_ARGUMENT)
+ return Empty()
+ try:
+ assert isinstance(request, TcontsConfigData), \
+ 'Instance is not of TCont'
+ tcont_ref_by_gemport = next(
+ (gemport for gemport in self.root.get('/gemports')
+ if gemport.tcont_ref == request.name), None)
+ assert tcont_ref_by_gemport is None, \
+ 'The Tcont -- \'{}\' is referenced by GemPort'.format(
+ request.name)
+ path = '/tconts/{}'.format(request.name)
+ log.debug('removing-tcont', name=request.name)
+ self.root.remove(path)
+ return Empty()
+ except AssertionError, e:
+ context.set_details(e.message)
+ context.set_code(StatusCode.INVALID_ARGUMENT)
+ return Empty()
+ except KeyError:
+ context.set_details(
+ 'tcont \'{}\' not found'.format(request.name))
+ context.set_code(StatusCode.NOT_FOUND)
+ return Empty()
+
+ def get_all_gemports_config_data(self, request, context):
+ log.info('grpc-request', request=request)
+ items = self.root.get('/gemports')
+ return AllGemportsConfigData(gemports_config=items)
+
+ def create_gem_port(self, request, context):
+ log.info('grpc-request', request=request)
+ try:
+ assert isinstance(request, GemportsConfigData)
+ assert self.validate_interface(request, context)
+ '''
+ @TODO: Allocation of Gemport-ID
+ '''
+ log.debug('creating-gemport', name=request.name)
+ self.root.add('/gemports', request)
+ return Empty()
+ except AssertionError, e:
+ return Empty()
+ except KeyError:
+ context.set_details(
+ 'Cannot create gemport \'{}\''.format(request.name))
+ context.set_code(StatusCode.NOT_FOUND)
+ return Empty()
+ except ValueError:
+ context.set_details(
+ 'Duplicated gemport \'{}\' cannot be created'.format(
+ request.name))
+ context.set_code(StatusCode.INVALID_ARGUMENT)
+ return Empty()
+
+ def update_gem_port(self, request, context):
+ log.info('grpc-request', request=request)
+ if '/' in request.name:
+ context.set_details(
+ 'Malformed name \'{}\''.format(request.name))
+ context.set_code(StatusCode.INVALID_ARGUMENT)
+ return GemportsConfigData()
+ try:
+ assert isinstance(request, GemportsConfigData)
+ assert self.validate_interface(request, context)
+
+ path = '/gemports/{}'.format(request.name)
+ log.debug('updating-gemport', name=request.name)
+ self.root.update(path, request, strict=True)
+ return Empty()
+ except AssertionError, e:
+ return Empty()
+ except KeyError:
+ context.set_details(
+ 'gemport \'{}\' not found'.format(request.name))
+ context.set_code(StatusCode.NOT_FOUND)
+ return Empty()
+
+ def delete_gem_port(self, request, context):
+ log.info('grpc-request', request=request)
+ if '/' in request.name:
+ context.set_details(
+ 'Malformed name \'{}\''.format(request.name))
+ context.set_code(StatusCode.INVALID_ARGUMENT)
+ return Empty()
+ try:
+ assert isinstance(request, GemportsConfigData)
+ path = '/gemports/{}'.format(request.name)
+ log.debug('removing-gemport', name=request.name)
+ self.root.remove(path)
+ return Empty()
+ except AssertionError:
+ context.set_details('Instance is not of gemport')
+ context.set_code(StatusCode.INVALID_ARGUMENT)
+ return Empty()
+ except KeyError:
+ context.set_details(
+ 'gemport \'{}\' not found'.format(request.name))
+ context.set_code(StatusCode.NOT_FOUND)
+ return Empty()
+
def validate_interface(self, request, context):
try:
if(isinstance(request, ChannelgroupConfig)):
@@ -886,9 +1147,63 @@
assert self.get_ref_data(
request, context, "v_ont_anis",
venet.data.v_ontani_ref), \
- 'Reference to ont ani -- \'{}\' not found'\
+ 'Reference to vont ani -- \'{}\' not found'\
.format(venet.data.v_ontani_ref)
return True
+ elif(isinstance(request, TrafficDescriptorProfileData)):
+ assert isinstance(request, TrafficDescriptorProfileData)
+ traffic_descriptor = request
+ assert traffic_descriptor.name != '', \
+ 'Traffic Descriptor Profile name is mandatory'
+ assert traffic_descriptor.fixed_bandwidth != '', \
+ 'Fixed bandwidth of Traffic Descriptor is mandatory'
+ assert traffic_descriptor.assured_bandwidth != '', \
+ 'Assured bandwidth of Traffic Descriptor is mandatory'
+ assert traffic_descriptor.maximum_bandwidth != '', \
+ 'Maximum bandwidth of Traffic Descriptor is mandatory'
+ assert 0 <= traffic_descriptor.priority <= 8, \
+ 'Traffic Descriptor Profile priority for or scheduling \
+ traffic on a TCont must be in range of [1, 8]'
+ return True
+ elif(isinstance(request, TcontsConfigData)):
+ assert isinstance(request, TcontsConfigData)
+ tcont = request
+ assert tcont.name != '', 'TCont name is mandatory'
+ assert tcont.interface_reference != '', \
+ 'TCont must reference a vont ani interface'
+ assert tcont.traffic_descriptor_profile_ref != '', \
+ 'TCont must reference an existing traffic descriptor \
+ profile'
+ assert self.get_ref_data(
+ request, context, "v_ont_anis",
+ tcont.interface_reference), \
+ 'Reference to vont ani interface -- \'{}\' not found'\
+ .format(tcont.interface_reference)
+ assert self.get_ref_data(
+ request, context, "traffic_descriptor_profiles",
+ tcont.traffic_descriptor_profile_ref), \
+ 'Reference to traffic descriptor profile -- \'{}\' \
+ not found'.format(tcont.traffic_descriptor_profile_ref)
+ return True
+ elif(isinstance(request, GemportsConfigData)):
+ assert isinstance(request, GemportsConfigData)
+ gemport = request
+ assert gemport.name != '', 'Gemport name is mandatory'
+ assert gemport.itf_ref != '', \
+ 'Gemport must reference an existing VEnet interface'
+ assert self.get_ref_data(
+ request, context, "v_enets", gemport.itf_ref), \
+ 'Reference to VEnet interface -- \'{}\' not found'\
+ .format(gemport.itf_ref)
+ assert 0 <= gemport.traffic_class <= 7, \
+ 'Traffic class value for Gemport \
+ must be in range of [0, 7]'
+ if gemport.tcont_ref:
+ assert self.get_ref_data(
+ request, context, "tconts", gemport.tcont_ref), \
+ 'Reference to tcont -- \'{}\' not found'\
+ .format(gemport.tcont_ref)
+ return True
else:
return False
except AssertionError, e:
diff --git a/voltha/protos/ponsim.proto b/voltha/protos/ponsim.proto
index 3ea7767..4915dab 100644
--- a/voltha/protos/ponsim.proto
+++ b/voltha/protos/ponsim.proto
@@ -5,6 +5,11 @@
import "google/protobuf/empty.proto";
import "openflow_13.proto";
import "bbf_fiber_base.proto";
+import "bbf_fiber_gemport_body.proto";
+import "bbf_fiber_multicast_distribution_set_body.proto";
+import "bbf_fiber_multicast_gemport_body.proto";
+import "bbf_fiber_tcont_body.proto";
+import "bbf_fiber_traffic_descriptor_profile_body.proto";
message PonSimDeviceInfo {
int32 nni_port = 1;
@@ -31,18 +36,30 @@
repeated PonSimPortMetrics metrics = 2;
}
-message InterfaceConfig
-{
- oneof interface_type
- {
- bbf_fiber.ChannelgroupConfig channel_group_config = 1;
- bbf_fiber.ChannelpartitionConfig channel_partition_config = 2;
- bbf_fiber.ChannelpairConfig channel_pair_config = 3;
- bbf_fiber.ChannelterminationConfig channel_termination_config = 4;
- bbf_fiber.OntaniConfig ont_ani_config = 5;
- bbf_fiber.VOntaniConfig vont_ani_config = 6;
- bbf_fiber.VEnetConfig venet_config = 7;
- }
+message TcontInterfaceConfig {
+ bbf_fiber.TrafficDescriptorProfileData
+ traffic_descriptor_profile_config_data = 1;
+ bbf_fiber.TcontsConfigData tconts_config_data = 2;
+}
+
+message InterfaceConfig {
+ oneof interface_type {
+ bbf_fiber.ChannelgroupConfig channel_group_config = 1;
+ bbf_fiber.ChannelpartitionConfig channel_partition_config = 2;
+ bbf_fiber.ChannelpairConfig channel_pair_config = 3;
+ bbf_fiber.ChannelterminationConfig channel_termination_config = 4;
+ bbf_fiber.OntaniConfig ont_ani_config = 5;
+ bbf_fiber.VOntaniConfig vont_ani_config = 6;
+ bbf_fiber.VEnetConfig venet_config = 7;
+ bbf_fiber.TrafficDescriptorProfileData
+ traffic_descriptor_profile_config_data = 8;
+ bbf_fiber.TcontsConfigData tconts_config_data = 9;
+ bbf_fiber.GemportsConfigData gemports_config_data = 10;
+ bbf_fiber.MulticastGemportsConfigData
+ multicast_gemports_config_data = 11;
+ bbf_fiber.MulticastDistributionSetData
+ multicast_distribution_set_data = 12;
+ }
}
service PonSim {
@@ -58,8 +75,8 @@
}
-service XPonSim
-{
+service XPonSim {
+
rpc CreateInterface(InterfaceConfig)
returns(google.protobuf.Empty) {}
@@ -68,4 +85,40 @@
rpc RemoveInterface(InterfaceConfig)
returns(google.protobuf.Empty) {}
+
+ rpc CreateTcont(TcontInterfaceConfig)
+ returns(google.protobuf.Empty) {}
+
+ rpc UpdateTcont(TcontInterfaceConfig)
+ returns(google.protobuf.Empty) {}
+
+ rpc RemoveTcont(TcontInterfaceConfig)
+ returns(google.protobuf.Empty) {}
+
+ rpc CreateGemport(InterfaceConfig)
+ returns(google.protobuf.Empty) {}
+
+ rpc UpdateGemport(InterfaceConfig)
+ returns(google.protobuf.Empty) {}
+
+ rpc RemoveGemport(InterfaceConfig)
+ returns(google.protobuf.Empty) {}
+
+ rpc CreateMulticastGemport(InterfaceConfig)
+ returns(google.protobuf.Empty) {}
+
+ rpc UpdateMulticastGemport(InterfaceConfig)
+ returns(google.protobuf.Empty) {}
+
+ rpc RemoveMulticastGemport(InterfaceConfig)
+ returns(google.protobuf.Empty) {}
+
+ rpc CreateMulticastDistributionSet(InterfaceConfig)
+ returns(google.protobuf.Empty) {}
+
+ rpc UpdateMulticastDistributionSet(InterfaceConfig)
+ returns(google.protobuf.Empty) {}
+
+ rpc RemoveMulticastDistributionSet(InterfaceConfig)
+ returns(google.protobuf.Empty) {}
}