[CONTROLLER-1304] Unable to configure BGP peer via RESTCONF even without peer-role Created: 12/May/15  Updated: 03/Jun/15  Resolved: 03/Jun/15

Status: Verified
Project: controller
Component/s: netconf
Affects Version/s: Post-Helium
Fix Version/s: None

Type: Bug
Reporter: Vratko Polak Assignee: Maros Marsalek
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issue Links:
Blocks
is blocked by CONTROLLER-1050 Proper support for ENUMs in Netconf n... Resolved
External issue ID: 3182

 Description   

This bug is very similar to CONTROLLER-1283 (point 6.) and the two bugs mean there is no workaround to configure BGP peer via RESTCONF (with XML data).

To replicate:
0. install and start ODL
1. feature:install odl-restconf odl-bgpcep-bgp-all
2. curl to add bgp-peer configuration (XML, without peer-role element)
3. HTTP status code 500 and exception in karaf log.

The exception contains this:
No enum constant org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole.ibgp
which suggests this bug is also the one that will get fixed with CONTROLLER-1050.

The curl command:
curl -v -X PUT -H "Content-Type:application/xml" -u 'admin:admin' -d '<module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-peer</type>
<name>example-bgp-peer</name>
<host xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">127.0.0.100</host>
<port xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">17900</port>
<holdtimer xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">180</holdtimer>
<initiate-connection xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">false</initiate-connection>
<rib xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:cfg">prefix:rib</type>
<name>example-bgp-rib</name>
</rib>
<peer-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-peer-registry</type>
<name>global-bgp-peer-registry</name>
</peer-registry>
<advertized-table xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
<name>ipv4-unicast</name>
</advertized-table>
<advertized-table xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
<name>ipv6-unicast</name>
</advertized-table>
<advertized-table xmlns="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-table-type</type>
<name>linkstate</name>
</advertized-table>
</module>' http://127.0.0.1:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/odl-bgp-rib-impl-cfg:bgp-peer/example-bgp-peer

The full (first) exception:
2015-05-12 10:36:29,340 | ERROR | entLoopGroup-2-2 | NetconfOperationRouterImpl | 124 - org.opendaylight.controller.netconf-impl - 0.3.0.SNAPSHOT | Unexpected exception during netconf operation execution
java.lang.IllegalStateException: Unable to set attributes for org.opendaylight.controller:instanceName=example-bgp-peer,TransactionName=ConfigTransaction-105-109,type=Module,moduleFactoryName=bgp-peer, Error with attribute peer-role:AttributeConfigElement [defaultValue=ibgp, value=null]
at org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.ReplaceEditConfigStrategy.executeStrategy(ReplaceEditConfigStrategy.java:57)[107:org.opendaylight.controller.config-netconf-connector:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.AbstractEditConfigStrategy.executeConfiguration(AbstractEditConfigStrategy.java:32)[107:org.opendaylight.controller.config-netconf-connector:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.EditConfig.setOnTransaction(EditConfig.java:188)[107:org.opendaylight.controller.config-netconf-connector:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.EditConfig.test(EditConfig.java:119)[107:org.opendaylight.controller.config-netconf-connector:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.EditConfig.executeTests(EditConfig.java:95)[107:org.opendaylight.controller.config-netconf-connector:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.EditConfig.getResponseInternal(EditConfig.java:74)[107:org.opendaylight.controller.config-netconf-connector:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.EditConfig.handleWithNoSubsequentOperations(EditConfig.java:302)[107:org.opendaylight.controller.config-netconf-connector:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.util.mapping.AbstractLastNetconfOperation.handle(AbstractLastNetconfOperation.java:33)[105:org.opendaylight.controller.netconf-util:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.util.mapping.AbstractNetconfOperation.handle(AbstractNetconfOperation.java:100)[105:org.opendaylight.controller.netconf-util:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.impl.osgi.NetconfOperationRouterImpl$NetconfOperationExecution.execute(NetconfOperationRouterImpl.java:185)[124:org.opendaylight.controller.netconf-impl:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.impl.osgi.NetconfOperationRouterImpl.executeOperationWithHighestPriority(NetconfOperationRouterImpl.java:114)[124:org.opendaylight.controller.netconf-impl:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.impl.osgi.NetconfOperationRouterImpl.onNetconfMessage(NetconfOperationRouterImpl.java:87)[124:org.opendaylight.controller.netconf-impl:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.impl.NetconfServerSessionListener.processDocument(NetconfServerSessionListener.java:113)[124:org.opendaylight.controller.netconf-impl:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.impl.NetconfServerSessionListener.onMessage(NetconfServerSessionListener.java:86)[124:org.opendaylight.controller.netconf-impl:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.impl.NetconfServerSessionListener.onMessage(NetconfServerSessionListener.java:29)[124:org.opendaylight.controller.netconf-impl:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.nettyutil.AbstractNetconfSession.handleMessage(AbstractNetconfSession.java:61)[115:org.opendaylight.controller.netconf-netty-util:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.nettyutil.AbstractNetconfSession.handleMessage(AbstractNetconfSession.java:32)[115:org.opendaylight.controller.netconf-netty-util:0.3.0.SNAPSHOT]
at org.opendaylight.protocol.framework.AbstractProtocolSession.channelRead0(AbstractProtocolSession.java:53)[71:org.opendaylight.controller.protocol-framework:0.6.0.SNAPSHOT]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)[68:io.netty.transport:4.0.26.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)[68:io.netty.transport:4.0.26.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)[68:io.netty.transport:4.0.26.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:242)[120:io.netty.codec:4.0.26.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)[68:io.netty.transport:4.0.26.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)[68:io.netty.transport:4.0.26.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:242)[120:io.netty.codec:4.0.26.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339)[68:io.netty.transport:4.0.26.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324)[68:io.netty.transport:4.0.26.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:847)[68:io.netty.transport:4.0.26.Final]
at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:326)[68:io.netty.transport:4.0.26.Final]
at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:45)[68:io.netty.transport:4.0.26.Final]
at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:312)[68:io.netty.transport:4.0.26.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)[61:io.netty.common:4.0.26.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)[68:io.netty.transport:4.0.26.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)[61:io.netty.common:4.0.26.Final]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)[61:io.netty.common:4.0.26.Final]
at java.lang.Thread.run(Thread.java:745)[:1.7.0_75]
Caused by: java.lang.IllegalStateException: Unable to set attribute PeerRole for org.opendaylight.controller:instanceName=example-bgp-peer,TransactionName=ConfigTransaction-105-109,type=Module,moduleFactoryName=bgp-peer
at org.opendaylight.controller.config.util.ConfigTransactionJMXClient.setAttribute(ConfigTransactionJMXClient.java:290)[92:org.opendaylight.controller.config-util:0.3.0.SNAPSHOT]
at org.opendaylight.controller.netconf.confignetconfconnector.operations.editconfig.ReplaceEditConfigStrategy.executeStrategy(ReplaceEditConfigStrategy.java:47)[107:org.opendaylight.controller.config-netconf-connector:0.3.0.SNAPSHOT]
... 35 more
Caused by: javax.management.MBeanException: interface org.opendaylight.controller.config.yang.bgp.rib.impl.BGPPeerModuleMXBean.setPeerRole: cannot convert parameters from open values: java.io.InvalidObjectException: Cannot convert to enum: ibgp
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:191)[:1.7.0_75]
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:175)[:1.7.0_75]
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:117)[:1.7.0_75]
at com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:54)[:1.7.0_75]
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeSetter(MBeanIntrospector.java:267)[:1.7.0_75]
at com.sun.jmx.mbeanserver.PerInterface.setAttribute(PerInterface.java:102)[:1.7.0_75]
at com.sun.jmx.mbeanserver.MBeanSupport.setAttribute(MBeanSupport.java:230)[:1.7.0_75]
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.setAttribute(DefaultMBeanServerInterceptor.java:746)[:1.7.0_75]
at com.sun.jmx.mbeanserver.JmxMBeanServer.setAttribute(JmxMBeanServer.java:739)[:1.7.0_75]
at org.opendaylight.controller.config.manager.impl.dynamicmbean.DynamicWritableWrapper.setAttribute(DynamicWritableWrapper.java:96)[97:org.opendaylight.controller.config-manager:0.3.0.SNAPSHOT]
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.setAttribute(DefaultMBeanServerInterceptor.java:746)[:1.7.0_75]
at com.sun.jmx.mbeanserver.JmxMBeanServer.setAttribute(JmxMBeanServer.java:739)[:1.7.0_75]
at org.opendaylight.controller.config.util.ConfigTransactionJMXClient.setAttribute(ConfigTransactionJMXClient.java:288)[92:org.opendaylight.controller.config-util:0.3.0.SNAPSHOT]
... 36 more
Caused by: java.io.InvalidObjectException: Cannot convert to enum: ibgp
at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory.invalidObjectException(DefaultMXBeanMappingFactory.java:1415)[:1.7.0_75]
at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$EnumMapping.fromNonNullOpenValue(DefaultMXBeanMappingFactory.java:535)[:1.7.0_75]
at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$EnumMapping.fromNonNullOpenValue(DefaultMXBeanMappingFactory.java:516)[:1.7.0_75]
at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$NonNullMXBeanMapping.fromOpenValue(DefaultMXBeanMappingFactory.java:132)[:1.7.0_75]
at com.sun.jmx.mbeanserver.ConvertingMethod.fromOpenParameters(ConvertingMethod.java:150)[:1.7.0_75]
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:186)[:1.7.0_75]
... 48 more
Caused by: java.lang.IllegalArgumentException: No enum constant org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole.ibgp
at java.lang.Enum.valueOf(Enum.java:236)[:1.7.0_75]
at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$EnumMapping.fromNonNullOpenValue(DefaultMXBeanMappingFactory.java:533)[:1.7.0_75]
... 52 more



 Comments   
Comment by Maros Marsalek [ 26/May/15 ]

Fixes have been merged into stable/lithium.

Comment by Vratko Polak [ 03/Jun/15 ]

Verified on Lithium, this CSIT test case track the request itself does not fail:
https://jenkins.opendaylight.org/releng/view/CSIT-Jobs/job/bgpcep-csit-1node-cds-userfeatures-only-stable-lithium/lastSuccessfulBuild/robot/bgpcep-userfeatures.txt/Bgpuser/Cases/Reconfigure_ODL_To_Accept_Connection/

and this test case confirms BGP is indeed working properly:
https://jenkins.opendaylight.org/releng/view/CSIT-Jobs/job/bgpcep-csit-1node-cds-userfeatures-only-stable-lithium/lastSuccessfulBuild/robot/bgpcep-userfeatures.txt/Bgpuser/Cases/Check_Talking_Topology_Is_Filled/

Generated at Wed Feb 07 19:55:11 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.