Search in sources :

Example 16 with VlanId

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);
}
Also used : VlanVid(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.vlan.vid._case.VlanVid) VlanMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder) VlanIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) VlanMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder) VlanId(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId)

Example 17 with VlanId

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)));
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action) SetVlanIdActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder) SetVlanIdActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder) VlanId(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId) Test(org.junit.Test)

Example 18 with VlanId

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;
}
Also used : MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) MatchVlanVid(org.opendaylight.genius.mdsalutil.matches.MatchVlanVid) ArrayList(java.util.ArrayList) MatchInPort(org.opendaylight.genius.mdsalutil.matches.MatchInPort) IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)

Example 19 with VlanId

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);
}
Also used : IpPrefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix) SubnetsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey) HashMap(java.util.HashMap) TransportZoneBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) StateTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 20 with VlanId

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);
}
Also used : TransportZonesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZonesBuilder) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)27 VlanId (org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId)26 BigInteger (java.math.BigInteger)14 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)12 IfL2vlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)12 List (java.util.List)11 Test (org.junit.Test)11 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)10 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)10 VlanMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder)10 VlanIdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder)10 SetVlanIdActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder)9 SubnetsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey)9 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)8 SetVlanIdActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder)6 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)6 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)6 TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)6 Vteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps)6 VtepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.VtepsKey)6