Program: 132026
Project: 132026
Buggy source:
@Test public void testAugmentSffWithOpenFlowNodeId1() throws Exception {
  final String ofNodeId="String_Node_Str";
  OvsdbNodeAugmentationBuilder ovsdbNodeAugmentationBuilder=new OvsdbNodeAugmentationBuilder();
  org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress ipAddress=new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address(TEST_IP_ADDRESS));
  ovsdbNodeAugmentationBuilder.setConnectionInfo(new ConnectionInfoBuilder().setRemoteIp(ipAddress).build());
  NodeBuilder nodeBuilder=new NodeBuilder();
  nodeBuilder.setKey(new NodeKey(new NodeId("String_Node_Str"))).addAugmentation(OvsdbNodeAugmentation.class,ovsdbNodeAugmentationBuilder.build());
  InstanceIdentifier<Node> nodeIID=InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)).child(Node.class,new NodeKey(new NodeId("String_Node_Str")));
  boolean transactionSuccessful=SfcDataStoreAPI.writePutTransactionAPI(nodeIID,nodeBuilder.build(),LogicalDatastoreType.CONFIGURATION);
  assertTrue("String_Node_Str",transactionSuccessful);
  ServiceFunctionForwarderBuilder serviceFunctionForwarderBuilder=new ServiceFunctionForwarderBuilder();
  serviceFunctionForwarderBuilder.setKey(new ServiceFunctionForwarderKey(new SffName(TEST_STRING))).setIpMgmtAddress(new IpAddress(new Ipv4Address(TEST_IP_ADDRESS)));
  ServiceFunctionForwarder serviceFunctionForwarder=serviceFunctionForwarderBuilder.build();
  assertNotNull("String_Node_Str",serviceFunctionForwarder);
  assertEquals("String_Node_Str",serviceFunctionForwarder.getKey().getName().getValue(),TEST_STRING);
  assertEquals("String_Node_Str",serviceFunctionForwarder.getIpMgmtAddress().getIpv4Address().getValue(),TEST_IP_ADDRESS);
  OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder=new OvsdbBridgeAugmentationBuilder();
  ovsdbBridgeAugmentationBuilder.setDatapathId(new DatapathId(TEST_DATA_PATH));
  InstanceIdentifier<OvsdbBridgeAugmentation> bridgeEntryIID=InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)).child(Node.class,new NodeKey(new NodeId(TEST_IP_ADDRESS + "String_Node_Str" + TEST_BRIDGE_NAME))).augmentation(OvsdbBridgeAugmentation.class);
  transactionSuccessful=SfcDataStoreAPI.writePutTransactionAPI(bridgeEntryIID,ovsdbBridgeAugmentationBuilder.build(),LogicalDatastoreType.OPERATIONAL);
  assertTrue("String_Node_Str",transactionSuccessful);
  IpBuilder ipBuilder=new IpBuilder();
  ipBuilder.setIp(new IpAddress(new Ipv4Address(IP_ADDRESS))).setPort(new PortNumber(5000));
  DataPlaneLocatorBuilder dataPlaneLocatorBuilder=new DataPlaneLocatorBuilder();
  dataPlaneLocatorBuilder.setTransport(VxlanGpe.class).setLocatorType(ipBuilder.build());
  List<SffDataPlaneLocator> sffDataPlaneLocators=new ArrayList<>();
  SffDataPlaneLocatorBuilder sffDataPlaneLocatorBuilder=new SffDataPlaneLocatorBuilder();
  SffDataPlaneLocatorName sffDplName=new SffDataPlaneLocatorName("String_Node_Str");
  sffDataPlaneLocatorBuilder.setName(sffDplName).setKey(new SffDataPlaneLocatorKey(sffDplName)).setDataPlaneLocator(dataPlaneLocatorBuilder.build());
  sffDataPlaneLocators.add(sffDataPlaneLocatorBuilder.build());
  OvsBridgeBuilder ovsBridgeBuilder=new OvsBridgeBuilder();
  ovsBridgeBuilder.setBridgeName(TEST_BRIDGE_NAME);
  SffOvsBridgeAugmentationBuilder sffOvsBridgeAugmentationBuilder=new SffOvsBridgeAugmentationBuilder();
  sffOvsBridgeAugmentationBuilder.setOvsBridge(ovsBridgeBuilder.build());
  serviceFunctionForwarderBuilder=new ServiceFunctionForwarderBuilder();
  serviceFunctionForwarderBuilder.addAugmentation(SffOvsBridgeAugmentation.class,sffOvsBridgeAugmentationBuilder.build()).setKey(new ServiceFunctionForwarderKey(new SffName(TEST_STRING))).setSffDataPlaneLocator(sffDataPlaneLocators);
  serviceFunctionForwarder=SfcOvsUtil.augmentSffWithOpenFlowNodeId(serviceFunctionForwarderBuilder.build());
  assertNotNull("String_Node_Str",serviceFunctionForwarder);
  assertEquals("String_Node_Str",serviceFunctionForwarder.getAugmentation(SffOvsBridgeAugmentation.class).getOvsBridge().getOpenflowNodeId(),ofNodeId);
  assertEquals("String_Node_Str",serviceFunctionForwarder.getKey().getName().getValue(),TEST_STRING);
}

Fixed version (ground truth):
@Test public void testAugmentSffWithOpenFlowNodeId1() throws Exception {
  final String ofNodeId="String_Node_Str";
  OvsdbNodeAugmentationBuilder ovsdbNodeAugmentationBuilder=new OvsdbNodeAugmentationBuilder();
  org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress ipAddress=new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address(TEST_IP_ADDRESS));
  ovsdbNodeAugmentationBuilder.setConnectionInfo(new ConnectionInfoBuilder().setRemoteIp(ipAddress).build());
  NodeBuilder nodeBuilder=new NodeBuilder();
  nodeBuilder.setKey(new NodeKey(new NodeId("String_Node_Str"))).addAugmentation(OvsdbNodeAugmentation.class,ovsdbNodeAugmentationBuilder.build());
  InstanceIdentifier<Node> ovsdbNodeIID=InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)).child(Node.class,new NodeKey(new NodeId("String_Node_Str")));
  boolean transactionSuccessful=SfcDataStoreAPI.writePutTransactionAPI(ovsdbNodeIID,nodeBuilder.build(),LogicalDatastoreType.CONFIGURATION);
  assertTrue("String_Node_Str",transactionSuccessful);
  ServiceFunctionForwarderBuilder serviceFunctionForwarderBuilder=new ServiceFunctionForwarderBuilder();
  serviceFunctionForwarderBuilder.setKey(new ServiceFunctionForwarderKey(new SffName(TEST_STRING))).setIpMgmtAddress(new IpAddress(new Ipv4Address(TEST_IP_ADDRESS)));
  ServiceFunctionForwarder serviceFunctionForwarder=serviceFunctionForwarderBuilder.build();
  assertNotNull("String_Node_Str",serviceFunctionForwarder);
  assertEquals("String_Node_Str",serviceFunctionForwarder.getKey().getName().getValue(),TEST_STRING);
  assertEquals("String_Node_Str",serviceFunctionForwarder.getIpMgmtAddress().getIpv4Address().getValue(),TEST_IP_ADDRESS);
  OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder=new OvsdbBridgeAugmentationBuilder();
  ovsdbBridgeAugmentationBuilder.setDatapathId(new DatapathId(TEST_DATA_PATH));
  InstanceIdentifier<OvsdbBridgeAugmentation> bridgeEntryIID=InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)).child(Node.class,new NodeKey(new NodeId(TEST_IP_ADDRESS + "String_Node_Str" + TEST_BRIDGE_NAME))).augmentation(OvsdbBridgeAugmentation.class);
  transactionSuccessful=SfcDataStoreAPI.writePutTransactionAPI(bridgeEntryIID,ovsdbBridgeAugmentationBuilder.build(),LogicalDatastoreType.OPERATIONAL);
  assertTrue("String_Node_Str",transactionSuccessful);
  IpBuilder ipBuilder=new IpBuilder();
  ipBuilder.setIp(new IpAddress(new Ipv4Address(IP_ADDRESS))).setPort(new PortNumber(5000));
  DataPlaneLocatorBuilder dataPlaneLocatorBuilder=new DataPlaneLocatorBuilder();
  dataPlaneLocatorBuilder.setTransport(VxlanGpe.class).setLocatorType(ipBuilder.build());
  List<SffDataPlaneLocator> sffDataPlaneLocators=new ArrayList<>();
  SffDataPlaneLocatorBuilder sffDataPlaneLocatorBuilder=new SffDataPlaneLocatorBuilder();
  SffDataPlaneLocatorName sffDplName=new SffDataPlaneLocatorName("String_Node_Str");
  sffDataPlaneLocatorBuilder.setName(sffDplName).setKey(new SffDataPlaneLocatorKey(sffDplName)).setDataPlaneLocator(dataPlaneLocatorBuilder.build());
  sffDataPlaneLocators.add(sffDataPlaneLocatorBuilder.build());
  OvsBridgeBuilder ovsBridgeBuilder=new OvsBridgeBuilder();
  ovsBridgeBuilder.setBridgeName(TEST_BRIDGE_NAME);
  SffOvsBridgeAugmentationBuilder sffOvsBridgeAugmentationBuilder=new SffOvsBridgeAugmentationBuilder();
  sffOvsBridgeAugmentationBuilder.setOvsBridge(ovsBridgeBuilder.build());
  serviceFunctionForwarderBuilder=new ServiceFunctionForwarderBuilder();
  serviceFunctionForwarderBuilder.addAugmentation(SffOvsBridgeAugmentation.class,sffOvsBridgeAugmentationBuilder.build()).setKey(new ServiceFunctionForwarderKey(new SffName(TEST_STRING))).setSffDataPlaneLocator(sffDataPlaneLocators);
  serviceFunctionForwarder=SfcOvsUtil.augmentSffWithOpenFlowNodeId(serviceFunctionForwarderBuilder.build());
  assertNotNull("String_Node_Str",serviceFunctionForwarder);
  assertEquals("String_Node_Str",serviceFunctionForwarder.getAugmentation(SffOvsBridgeAugmentation.class).getOvsBridge().getOpenflowNodeId(),ofNodeId);
  assertEquals("String_Node_Str",serviceFunctionForwarder.getKey().getName().getValue(),TEST_STRING);
}