daily pastebin goal
69%
SHARE
TWEET

more-odl-test

a guest Oct 2nd, 2017 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package edu.ulaval.sdn.commons.mdsal;
  2.  
  3. import static org.junit.Assert.*;
  4.  
  5. import org.junit.Test;
  6. import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
  7. import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
  8. import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
  9. import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
  10. import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
  11. import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
  12. import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  13.  
  14. @SuppressWarnings("deprecation")
  15. public class MDSalAccessUtilsTest {
  16.  
  17.     @Test
  18.     @SuppressWarnings("unchecked")
  19.     public void IID_clarification_tests() {
  20.         NodeId nodeId = new NodeId("openflow:1");
  21.         NodeConnectorId ncId = new NodeConnectorId("openflow:1:1");
  22.         NodeConnectorRef nodeConnectorRef = MDSalAccessUtils.nodeConnectorRef(nodeId, ncId);
  23.         InstanceIdentifier<NodeConnector> iid = (InstanceIdentifier<NodeConnector>) nodeConnectorRef.getValue();
  24.         String res = iid.toString();
  25.         String expected = "KeyedInstanceIdentifier{"
  26.                         + "targetType=interface org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector, "
  27.                         + "path=[org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes, "
  28.                         + "org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node"
  29.                                                        + "[key=NodeKey [_id=Uri [_value=openflow:1]]], "
  30.                         + "org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector"
  31.                                                        + "[key=NodeConnectorKey [_id=Uri [_value=openflow:1:1]]]]}";
  32.         assertEquals(res, expected);
  33.        
  34.         res = Nodes.QNAME.getLocalName() + "/" + Node.QNAME.getLocalName() + "/" + "1" + "/" + NodeConnector.QNAME.getLocalName() + "/" + "1";
  35.         expected = "nodes/node/1/node-connector/1";
  36.         assertEquals(expected, res);
  37.     }
  38.    
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top