Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-625

getting protocol value from the security rule object in SecurityRuleListener code is throwing exception.

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • None
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 6112
    • High

    Description

      Build used :
      ===================
      Karaf distribution from latest ODL Boron master code

      There are some changes merged in project neutron to revises yang model for security groups in file model/src/main/yang/neutron-secgroups.yang

      Changes:

      leaf protocol {
        type union {
          type uint8;
          type identityref {
            base "constants:protocol-base";
          }
        }
        description "The protocol that is matched by the security group rule.";
      }
      

      after this changes, listener code register for SecurityRule is failing at runtime at statement

      if (securityRule.getProtocol() != null)

      where securityRule is instance of
      org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.secgroups.rev150712.security.rules.attributes.security.rules.SecurityRule

      Exception:

      java.lang.ClassCastException: java.lang.String cannot be cast to org.opendaylight.yangtools.yang.common.QName
      	at org.opendaylight.yangtools.binding.data.codec.impl.IdentityCodec.deserialize(IdentityCodec.java:17)[118:org.opendaylight.mdsal.binding-dom-codec:0.9.0.SNAPSHOT]
      	at org.opendaylight.yangtools.binding.data.codec.impl.UnionTypeCodec.deserialize(UnionTypeCodec.java:103)[118:org.opendaylight.mdsal.binding-dom-codec:0.9.0.SNAPSHOT]
      	at org.opendaylight.yangtools.binding.data.codec.impl.LeafNodeCodecContext.deserializeObject(LeafNodeCodecContext.java:199)[118:org.opendaylight.mdsal.binding-dom-codec:0.9.0.SNAPSHOT]
      	at org.opendaylight.yangtools.binding.data.codec.impl.DataObjectCodecContext.getBindingChildValue(DataObjectCodecContext.java:328)[118:org.opendaylight.mdsal.binding-dom-codec:0.9.0.SNAPSHOT]
      	at org.opendaylight.yangtools.binding.data.codec.impl.KeyedListNodeCodecContext.getBindingChildValue(KeyedListNodeCodecContext.java:66)[118:org.opendaylight.mdsal.binding-dom-codec:0.9.0.SNAPSHOT]
      	at org.opendaylight.yangtools.binding.data.codec.impl.LazyDataObject.getBindingData(LazyDataObject.java:148)[118:org.opendaylight.mdsal.binding-dom-codec:0.9.0.SNAPSHOT]
      	at org.opendaylight.yangtools.binding.data.codec.impl.LazyDataObject.invoke(LazyDataObject.java:71)[118:org.opendaylight.mdsal.binding-dom-codec:0.9.0.SNAPSHOT]
      	at com.sun.proxy.$Proxy178.getProtocol(Unknown Source)
      	at org.opendaylight.netvirt.neutronvpn.NeutronSecurityRuleListener.toAceBuilder(NeutronSecurityRuleListener.java:132)[327:org.opendaylight.netvirt.neutronvpn-impl:0.3.0.SNAPSHOT]
      	at org.opendaylight.netvirt.neutronvpn.NeutronSecurityRuleListener.add(NeutronSecurityRuleListener.java:76)[327:org.opendaylight.netvirt.neutronvpn-impl:0.3.0.SNAPSHOT]
      	at org.opendaylight.netvirt.neutronvpn.NeutronSecurityRuleListener.add(NeutronSecurityRuleListener.java:44)[327:org.opendaylight.netvirt.neutronvpn-impl:0.3.0.SNAPSHOT]
      	at org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase$DataTreeChangeHandler.run(AsyncDataTreeChangeListenerBase.java:121)[300:org.opendaylight.genius.mdsalutil-api:0.1.0.SNAPSHOT]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_71]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_71]
      	at java.lang.Thread.run(Thread.java:745)[:1.8.0_71]
      

      I am using input and URL as

      URL: http://localhost:8181/restconf/config/neutron:neutron/security-rules/
      POST method
      JSON input:

      {
      "security-rule":

      { "uuid": "d0d639a5-ca9a-44a9-97c6-603c176c9672", "direction": "neutron-constants:direction-egress", "protocol": "neutron-constants:protocol-tcp", "security-group-id": "362cc56c-a9d4-4abc-9074-c5f83d305a2b" }

      }

      i tied by providing protocol value as 6.
      "protocol": 6,

      got same exception shown above.

      Note:
      POST/GET restconf is working but listening on data change notification does not work. SecurityRule change notification is received, but throws exception in code when we try to get protocol value using method "getProtocol()" .

      For reproducing this issue, Pls add a SecurityRule Listener and get the protocol value from securityRule object on receiving SeucirtyRule add event.

      Attachments

        1. karaf.log
          221 kB
        2. karaf.log
          231 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            yamahata Isaku Yamahata
            imanilyadav@gmail.com Anil Gujele
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: