use of org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId in project openflowplugin by opendaylight.
the class OfToSalVlanVidCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull VlanVidCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final VlanMatchBuilder vlanMatchBuilder = data.getVlanMatchBuilder();
final VlanVid vlanVid = source.getVlanVid();
if (vlanVid != null) {
VlanIdBuilder vlanBuilder = new VlanIdBuilder();
vlanBuilder.setVlanId(new VlanId(vlanVid.getVlanVid()));
vlanBuilder.setVlanIdPresent(vlanVid.isCfiBit());
vlanMatchBuilder.setVlanId(vlanBuilder.build());
matchBuilder.setVlanMatch(vlanMatchBuilder.build());
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId in project openflowplugin by opendaylight.
the class SetVlanIdActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final int vlan = 1;
final Action action = new SetVlanIdActionCaseBuilder().setSetVlanIdAction(new SetVlanIdActionBuilder().setVlanId(new VlanId(vlan)).build()).build();
assertAction(action, out -> assertEquals(out.readShort(), vlan | (1 << 12)));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId in project genius by opendaylight.
the class FlowBasedServicesUtils method getMatchInfoForVlanPortAtIngressTable.
public static List<MatchInfo> getMatchInfoForVlanPortAtIngressTable(BigInteger dpId, long portNo, Interface iface) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(new MatchInPort(dpId, portNo));
int vlanId = 0;
IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
if (l2vlan != null) {
vlanId = l2vlan.getVlanId() == null ? 0 : l2vlan.getVlanId().getValue();
}
if (vlanId >= 0 && l2vlan.getL2vlanMode() != IfL2vlan.L2vlanMode.Transparent) {
matches.add(new MatchVlanVid(vlanId));
}
return matches;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId in project genius by opendaylight.
the class TepCommandHelperTest method testCreateLocalCacheWithoutcheckExistingSubnet.
@Test
public void testCreateLocalCacheWithoutcheckExistingSubnet() {
IpAddress gatewayIpObj = IpAddressBuilder.getDefaultInstance("0.0.0.0");
IpPrefix subnetMaskObj = ipPrefixTest;
SubnetsKey subnetsKey = new SubnetsKey(subnetMaskObj);
SubnetObject subObCli = new SubnetObject(gatewayIpObj, subnetsKey, subnetMaskObj, vlanId);
Map<SubnetObject, List<Vteps>> subVtepMapTemp = new HashMap<>();
subVtepMapTemp.put(subObCli, vtepsList);
transportZoneNew = new TransportZoneBuilder().setZoneName(transportZone1).setTunnelType(tunnelType2).build();
doReturn(Futures.immediateCheckedFuture(Optional.of(transportZoneNew))).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, transportZoneIdentifier);
doReturn(Futures.immediateCheckedFuture(Optional.absent())).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, transportZonesIdentifier);
try {
tepCommandHelper.createLocalCache(dpId1, portName1, vlanId, tepIp1, subnetMask, gwyIp1, transportZone1, null);
tepCommandHelper.createLocalCache(dpId2, portName1, vlanId, tepIp1, subnetMask, gwyIp1, transportZone1, null);
} catch (TepException e) {
LOG.error(e.getMessage());
}
verify(mockReadTx, times(2)).read(LogicalDatastoreType.CONFIGURATION, transportZoneIdentifier);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId in project genius by opendaylight.
the class TepCommandHelperTest method testDeleteOnCommit.
@Test
public void testDeleteOnCommit() {
transportZoneList.add(transportZone);
transportZoneList.add(transportZoneNew);
transportZones = new TransportZonesBuilder().setTransportZone(transportZoneList).build();
optionalTransportZones = Optional.of(transportZones);
doReturn(Futures.immediateCheckedFuture(optionalTransportZones)).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, transportZonesIdentifier);
try {
tepCommandHelper.deleteVtep(dpId1, portName1, vlanId, tepIp1, subnetMask, gwyIp1, transportZone1, null);
} catch (TepException e) {
LOG.error(e.getMessage());
}
tepCommandHelper.deleteOnCommit();
verify(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, transportZonesIdentifier);
verify(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, vtepsIdentifier);
verify(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, subnetsIdentifier);
verify(mockWriteTx).delete(LogicalDatastoreType.CONFIGURATION, vtepsIdentifierNew);
verify(mockWriteTx).delete(LogicalDatastoreType.CONFIGURATION, subnetsIdentifier);
verify(mockWriteTx).delete(LogicalDatastoreType.CONFIGURATION, transportZoneIdentifier);
}
Aggregations