cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
124
Views
0
Helpful
1
Replies
csrm7
Cisco Employee

Help in configuring ingress physical channel

 

1.  Was trying to specify a physical channel for channel ingress config. The assignment is failing with yModelError.

 

>>> from ydk.models.openconfig import openconfig_terminal_device
>>> terminal_device = openconfig_terminal_device.TerminalDevice()
>>> channel = terminal_device.logical_channels.Channel()
>>> channel_ingress = channel.Ingress()
>>> ingress_config = channel_ingress.Config()
>>> ingress_config.physical_channel = [1]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/ydk_vne/lib/python3.6/site-packages/ydk/models/openconfig/openconfig_terminal_device.py", line 1836, in __setattr__
    self._perform_setattr(TerminalDevice.LogicalChannels.Channel.Ingress.Config, ['transceiver', 'physical_channel'], name, value)
  File "/root/ydk_vne/lib/python3.6/site-packages/ydk/types/py_types.py", line 390, in _perform_setattr
    _validate_value(self._leafs[name], name, value, self._logger)
  File "/root/ydk_vne/lib/python3.6/site-packages/ydk/types/py_types.py", line 894, in _validate_value
    raise YModelError(err_msg)
ydk.errors.YModelError: Invalid value [1] for 'physical_channel'. Got type: 'list'. Expected types: 'int'

 

2. I changed list to int and see this error.

>>> ingress_config.physical_channel = 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/ydk_vne/lib/python3.6/site-packages/ydk/models/openconfig/openconfig_terminal_device.py", line 1836, in __setattr__
    self._perform_setattr(TerminalDevice.LogicalChannels.Channel.Ingress.Config, ['transceiver', 'physical_channel'], name, value)
  File "/root/ydk_vne/lib/python3.6/site-packages/ydk/types/py_types.py", line 420, in _perform_setattr
    super(Entity, self).__setattr__(name, value)
  File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/root/ydk_vne/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 95, in handle_type_error
    _raise(_exc)
  File "/root/ydk_vne/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 54, in _raise
    exec("raise exc from None")
  File "<string>", line 1, in <module>
ydk.errors.YModelError: 'int' object is not iterable
>>> 

 

3. Output form a already configured channel for reference.

(Pdb) output.channel['200'].ingress.state
<ydk.models.bo_openconfig.openconfig_terminal_device.TerminalDevice.LogicalChannels.Channel.Ingress.State object at 0x7f1ddf34b620>
(Pdb) output.channel['200'].ingress.state.physical_channel
[1]
(Pdb) type(output.channel['200'].ingress.state.physical_channel)
<class 'list'>

4. Please let me know the correct way of doing this.

 

YDK Details:

(ydk_vne) root@ncselastic1:/ws/srchakka-bgl/bo# pip freeze | grep ydk
ydk==0.8.5
ydk-models-bo-openconfig==7.3.1
ydk-models-ietf==0.1.5.post2
ydk-models-openconfig==0.1.8
ydk-service-gnmi==0.4.0.post5

1 ACCEPTED SOLUTION

Accepted Solutions
yangorelik
Participant

The `physical-channel` in the YANG model is a leaf-list. It is represented in the Model API as YLeafList `physical_channel` and therefore it must be handled differently:

>>> ingress_config.physical_channel.append(1)

 

Yan Gorelik
YDK Solutions

View solution in original post

1 REPLY 1
yangorelik
Participant

The `physical-channel` in the YANG model is a leaf-list. It is represented in the Model API as YLeafList `physical_channel` and therefore it must be handled differently:

>>> ingress_config.physical_channel.append(1)

 

Yan Gorelik
YDK Solutions

View solution in original post

Content for Community-Ad

This widget could not be displayed.