Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing interface name not support with openconfig module #195

Closed
nowaits opened this issue Mar 26, 2021 · 6 comments
Closed

changing interface name not support with openconfig module #195

nowaits opened this issue Mar 26, 2021 · 6 comments
Labels

Comments

@nowaits
Copy link
Contributor

nowaits commented Mar 26, 2021

I import openconfig-interface to my yang file like this:

module test{
    ...

    import ietf-inet-types { prefix inet; }  
    import ietf-ip { prefix ietf-ip; }
    import ietf-interfaces { prefix if; }
    import iana-if-type { prefix ianaift; }

    import openconfig-extensions { prefix oc-ext; }
    import openconfig-inet-types { prefix oc-inet; }
    import openconfig-interfaces { prefix oc-if; }
    import openconfig-if-ethernet { prefix oc-eth; }
}

and the startup_db as following:

<configuration>
   <interfaces xmlns="http://openconfig.net/yang/interfaces">
      <interface>
         <name>eth0</name>
         <config>
            <name>eth0</name>
            <type>ianaift:ethernetCsmacd</type>
         </config>
      </interface>
   </interfaces>
</configuration>

There are two issues:

  1. In cli, for set interfaces interface has no eth0 suggestion.
root@localhost.localdomain />set interfaces interface 
 <name> 
  1. in cli, changing interface eth0 name to eth1 not support
root@localhost.localdomain />set interfaces interface eth0 config name eth1
root@localhost.localdomain />commit
Mar 26 17:26:15: Commit failed. Edit and try again or discard changes: application bad-element Leafref validation failed: No leaf eth0 matching path ../config/name <bad-element>eth0</bad-element>
CLI command error
@olofhagsand
Copy link
Member

Submitted patch for fixing at least nr 1 above. There was an error when the leafref referenced a part of the three that was not directly loaded.
Nr 2 may not be an error, since you change the target making the original leafref pointer invalid. But I am unsure exactly how a CLI should behave in such a construct.
This construct in openconfig-.interfaces is somewhat strange.
Please verify.

@nowaits
Copy link
Contributor Author

nowaits commented Apr 7, 2021

Hi ofof, in case nr1, i add '<CLICON_CLI_AUTOCLI_EXCLUDE>clixon-restconf ietf-interfaces</CLICON_CLI_AUTOCLI_EXCLUDE>' to config.xml and there still no eth0 suggestion
Bellow is the debug log

root@localhost.localdomain > show config interfaces           
Apr  7 17:16:03: clicon_parse result:1 command: "show config interfaces"
Apr  7 17:16:03: api_path2xpath_cvv [0] cvname: openconfig-interfaces:interfaces
Apr  7 17:16:03: api_path2xpath_cvv prefix not found add it oc-if
Apr  7 17:16:03: clicon_rpc_msg request:<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" username="root" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"><get-config><source><candidate/></source><nc:filter nc:type="xpath" nc:select="/oc-if:interfaces" xmlns:oc-if="http://openconfig.net/yang/interfaces"/></get-config></rpc>
Apr  7 17:16:03: clicon_rpc_msg retdata:<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><data><interfaces xmlns="http://openconfig.net/yang/interfaces"><interface><name>eth0</name><config><name>eth0</name><type>ianaift:ethernetCsmacd</type><loopback-mode>false</loopback-mode><enabled>true</enabled></config><hold-time><config><up>0</up><down>0</down></config></hold-time><oc-eth:ethernet xmlns:oc-eth="http://openconfig.net/yang/interfaces/ethernet"><oc-eth:config><oc-eth:auto-negotiate>true</oc-eth:auto-negotiate><oc-eth:enable-flow-control>false</oc-eth:enable-flow-control></oc-eth:config></oc-eth:ethernet></interface></interfaces></data></rpc-reply>
<interfaces xmlns="http://openconfig.net/yang/interfaces">
   <interface>
      <name>eth0</name>
      <config>
         <name>eth0</name>
         <type>ianaift:ethernetCsmacd</type>
         <loopback-mode>false</loopback-mode>
         <enabled>true</enabled>
      </config>
      <hold-time>
         <config>
            <up>0</up>
            <down>0</down>
         </config>
      </hold-time>
      <oc-eth:ethernet xmlns:oc-eth="http://openconfig.net/yang/interfaces/ethernet">
         <oc-eth:config>
            <oc-eth:auto-negotiate>true</oc-eth:auto-negotiate>
            <oc-eth:enable-flow-control>false</oc-eth:enable-flow-control>
         </oc-eth:config>
      </oc-eth:ethernet>
   </interface>
</interfaces>

root@localhost.localdomain (config) > set interfaces interface Apr  7 17:22:06: api_path2xpath_cvv [0] cvname: openconfig-interfaces:interfaces
Apr  7 17:22:06: api_path2xpath_cvv prefix not found add it oc-if
Apr  7 17:22:06: api_path2xpath_cvv [1] cvname: :interface
Apr  7 17:22:06: api_path2xpath_cvv [2] cvname: :name
Apr  7 17:22:06: clicon_rpc_msg request:<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" username="root" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"><get-config><source><candidate/></source><nc:filter nc:type="xpath" nc:select="/oc-if:interfaces/oc-if:interface/oc-if:name" xmlns:oc-if="http://openconfig.net/yang/interfaces"/></get-config></rpc>
Apr  7 17:22:06: clicon_rpc_msg retdata:<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><data><interfaces xmlns="http://openconfig.net/yang/interfaces"><interface><name>eth0</name><config><loopback-mode>false</loopback-mode><enabled>true</enabled></config><hold-time><config><up>0</up><down>0</down></config></hold-time><oc-eth:ethernet xmlns:oc-eth="http://openconfig.net/yang/interfaces/ethernet"><oc-eth:config><oc-eth:auto-negotiate>true</oc-eth:auto-negotiate><oc-eth:enable-flow-control>false</oc-eth:enable-flow-control></oc-eth:config></oc-eth:ethernet></interface></interfaces></data></rpc-reply>

Apr  7 17:22:06: api_path2xpath_cvv [0] cvname: openconfig-interfaces:interfaces
Apr  7 17:22:06: api_path2xpath_cvv prefix not found add it oc-if
Apr  7 17:22:06: api_path2xpath_cvv [1] cvname: :interface
Apr  7 17:22:06: api_path2xpath_cvv [2] cvname: :name
Apr  7 17:22:06: clicon_rpc_msg request:<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" username="root" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"><get-config><source><candidate/></source><nc:filter nc:type="xpath" nc:select="/oc-if:interfaces/oc-if:interface/oc-if:name" xmlns:oc-if="http://openconfig.net/yang/interfaces"/></get-config></rpc>
Apr  7 17:22:06: clicon_rpc_msg retdata:<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><data><interfaces xmlns="http://openconfig.net/yang/interfaces"><interface><name>eth0</name><config><loopback-mode>false</loopback-mode><enabled>true</enabled></config><hold-time><config><up>0</up><down>0</down></config></hold-time><oc-eth:ethernet xmlns:oc-eth="http://openconfig.net/yang/interfaces/ethernet"><oc-eth:config><oc-eth:auto-negotiate>true</oc-eth:auto-negotiate><oc-eth:enable-flow-control>false</oc-eth:enable-flow-control></oc-eth:config></oc-eth:ethernet></interface></interfaces></data></rpc-reply>
 <name>                
root@localhost.localdomain (config) > set interfaces interface 

@nowaits
Copy link
Contributor Author

nowaits commented Apr 8, 2021

Hi olof,
Nr 2, i think i'ts a way to rename interface name.
set interfaces interface eth0 config name eth1 the interface name is a leafref of config name, so if i change the config name, the interface name should also be changed.

'name' leafref 'config/name' is a rename operation for openconfig in many cases.

@olofhagsand
Copy link
Member

Nr 1: works for me:

olof@alarik /> show configuration xml 
<interfaces xmlns="http://openconfig.net/yang/interfaces">
   <interface>
      <name>e</name>
      <config>
         <name>e</name>
         <type>ex:eth</type>
         <loopback-mode>false</loopback-mode>
         <enabled>true</enabled>
      </config>
      <hold-time>
         <config>
            <up>0</up>
            <down>0</down>
         </config>
      </hold-time>
      <oc-eth:ethernet xmlns:oc-eth="http://openconfig.net/yang/interfaces/ethernet">
         <oc-eth:config>
            <oc-eth:auto-negotiate>true</oc-eth:auto-negotiate>
            <oc-eth:enable-flow-control>false</oc-eth:enable-flow-control>
         </oc-eth:config>
      </oc-eth:ethernet>
   </interface>
</interfaces>      
olof@alarik /> set interfaces interface <TAB> e ?
 config                   ethernet                 hold-time                subinterfaces 

@olofhagsand
Copy link
Member

Nr 2, i think i'ts a way to rename interface name.
set interfaces interface eth0 config name eth1 the interface name is a leafref of config name, so if i change the config name, the interface name should also be changed.

'name' leafref 'config/name' is a rename operation for openconfig in many cases.

Again, the construct is strange to me. It is as you say, it is a rename of the original, like changing the name of an original file.
You propose to change all leafref:s as well. That would correspond to changing all soft links (ln -s) to that original name.
I am not saying it is wrong, but I am not sure it is correct in all circumstances.

@olofhagsand
Copy link
Member

The leafref behavior has been changed quite significantly and no comments since April, therefore closing.
If this is still seen as a problem please submit a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants