use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.conntrack.grouping.nx.conntrack.CtActionsBuilder in project openflowplugin by opendaylight.
the class ConntrackConvertorTest method testConvertToOfJava.
@Test
public void testConvertToOfJava() throws Exception {
final NxActionNatBuilder nxActionNatBuilder = new NxActionNatBuilder().setFlags(1).setRangePresent(2).setIpAddressMin(new IpAddress("192.168.0.0".toCharArray())).setIpAddressMin(new IpAddress("192.168.10.0".toCharArray())).setPortMin(3000).setPortMax(4000);
final CtActionsBuilder ctActionsBuilder = new CtActionsBuilder().setOfpactActions(new NxActionNatCaseBuilder().setNxActionNat(nxActionNatBuilder.build()).build());
List<CtActions> ctAction = new ArrayList<>();
ctAction.add(ctActionsBuilder.build());
final NxConntrackBuilder nxConntrackBuilder = new NxConntrackBuilder().setConntrackZone(1).setFlags(1).setRecircTable((short) 1).setZoneSrc(1L).setCtActions(ctAction);
final NxActionConntrackNodesNodeTableFlowWriteActionsCaseBuilder nxActionConntrackBuilder = new NxActionConntrackNodesNodeTableFlowWriteActionsCaseBuilder().setNxConntrack(nxConntrackBuilder.build());
final NxActionConntrackNodesNodeTableFlowWriteActionsCase actionsCase = nxActionConntrackBuilder.build();
final ActionConntrack actionConntrack = (ActionConntrack) conntrackConvertor.convert(actionsCase).getActionChoice();
Assert.assertEquals(actionsCase.getNxConntrack().getConntrackZone(), actionConntrack.getNxActionConntrack().getConntrackZone());
Assert.assertEquals(actionsCase.getNxConntrack().getFlags(), actionConntrack.getNxActionConntrack().getFlags());
Assert.assertEquals(actionsCase.getNxConntrack().getRecircTable(), actionConntrack.getNxActionConntrack().getRecircTable());
Assert.assertEquals(actionsCase.getNxConntrack().getZoneSrc(), actionConntrack.getNxActionConntrack().getZoneSrc());
NxActionNat natactionCase = ((NxActionNatCase) actionsCase.getNxConntrack().getCtActions().get(0).getOfpactActions()).getNxActionNat();
org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNat nataction = ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.NxActionNatCase) actionConntrack.getNxActionConntrack().getCtActions().get(0).getOfpactActions()).getNxActionNat();
Assert.assertEquals(natactionCase.getFlags(), nataction.getFlags());
Assert.assertEquals(natactionCase.getRangePresent(), nataction.getRangePresent());
Assert.assertEquals(natactionCase.getIpAddressMin().getIpv4Address().getValue(), nataction.getIpAddressMin().getIpv4Address().getValue());
Assert.assertEquals(natactionCase.getIpAddressMin().getIpv4Address().getValue(), nataction.getIpAddressMin().getIpv4Address().getValue());
Assert.assertEquals(natactionCase.getPortMin(), nataction.getPortMin());
Assert.assertEquals(natactionCase.getPortMax(), nataction.getPortMax());
}
Aggregations