Search in sources :

Example 41 with GroupId

use of org.onosproject.core.GroupId in project onos by opennetworkinglab.

the class DistributedGroupStore method synchronizeGroupStoreEntries.

private void synchronizeGroupStoreEntries() {
    Map<GroupStoreKeyMapKey, StoredGroupEntry> groupEntryMap = groupStoreEntriesByKey.asJavaMap();
    for (Entry<GroupStoreKeyMapKey, StoredGroupEntry> entry : groupEntryMap.entrySet()) {
        StoredGroupEntry value = entry.getValue();
        ConcurrentMap<GroupId, StoredGroupEntry> groupIdTable = getGroupIdTable(value.deviceId());
        groupIdTable.put(value.id(), value);
    }
}
Also used : StoredGroupEntry(org.onosproject.net.group.StoredGroupEntry) GroupId(org.onosproject.core.GroupId)

Example 42 with GroupId

use of org.onosproject.core.GroupId in project onos by opennetworkinglab.

the class DistributedGroupStore method getFreeGroupIdValue.

private int getFreeGroupIdValue(DeviceId deviceId) {
    int freeId = groupIdGen.incrementAndGet();
    while (true) {
        Group existing = getGroup(deviceId, new GroupId(freeId));
        if (existing == null) {
            existing = (extraneousGroupEntriesById.get(deviceId) != null) ? extraneousGroupEntriesById.get(deviceId).get(new GroupId(freeId)) : null;
        }
        if (existing != null) {
            freeId = groupIdGen.incrementAndGet();
        } else {
            break;
        }
    }
    log.debug("getFreeGroupIdValue: Next Free ID is {}", freeId);
    return freeId;
}
Also used : DefaultGroup(org.onosproject.net.group.DefaultGroup) Group(org.onosproject.net.group.Group) GroupId(org.onosproject.core.GroupId)

Example 43 with GroupId

use of org.onosproject.core.GroupId in project onos by opennetworkinglab.

the class TunnelCreateCommand method doExecute.

@Override
protected void doExecute() {
    TunnelProvider service = get(TunnelProvider.class);
    ProviderId producerName = new ProviderId("default", "org.onosproject.provider.tunnel.default");
    TunnelEndPoint srcPoint = null;
    TunnelEndPoint dstPoint = null;
    Tunnel.Type trueType = null;
    if ("MPLS".equals(type)) {
        trueType = Tunnel.Type.MPLS;
        srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
        dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
    } else if ("VLAN".equals(type)) {
        trueType = Tunnel.Type.VLAN;
        String[] srcArray = src.split("/");
        String[] dstArray = dst.split("/");
        srcPoint = new DefaultOpticalTunnelEndPoint(producerName, Optional.of(DeviceId.deviceId(srcArray[0])), Optional.of(PortNumber.portNumber(srcArray[1])), null, null, OpticalLogicId.logicId(0), true);
        dstPoint = new DefaultOpticalTunnelEndPoint(producerName, Optional.of(DeviceId.deviceId(dstArray[0])), Optional.of(PortNumber.portNumber(dstArray[1])), null, null, OpticalLogicId.logicId(0), true);
    } else if ("VXLAN".equals(type)) {
        trueType = Tunnel.Type.VXLAN;
        srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
        dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
    } else if ("GRE".equals(type)) {
        trueType = Tunnel.Type.GRE;
        srcPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(src));
        dstPoint = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(dst));
    } else if ("ODUK".equals(type)) {
        trueType = Tunnel.Type.ODUK;
        String[] srcArray = src.split("/");
        String[] dstArray = dst.split("/");
        srcPoint = new DefaultOpticalTunnelEndPoint(producerName, Optional.of(DeviceId.deviceId(srcArray[0])), Optional.of(PortNumber.portNumber(srcArray[1])), null, OpticalTunnelEndPoint.Type.LAMBDA, OpticalLogicId.logicId(0), true);
        dstPoint = new DefaultOpticalTunnelEndPoint(producerName, Optional.of(DeviceId.deviceId(dstArray[0])), Optional.of(PortNumber.portNumber(dstArray[1])), null, OpticalTunnelEndPoint.Type.LAMBDA, OpticalLogicId.logicId(0), true);
    } else if ("OCH".equals(type)) {
        trueType = Tunnel.Type.OCH;
        String[] srcArray = src.split("/");
        String[] dstArray = dst.split("/");
        srcPoint = new DefaultOpticalTunnelEndPoint(producerName, Optional.of(DeviceId.deviceId(srcArray[0])), Optional.of(PortNumber.portNumber(srcArray[1])), null, OpticalTunnelEndPoint.Type.TIMESLOT, OpticalLogicId.logicId(0), true);
        dstPoint = new DefaultOpticalTunnelEndPoint(producerName, Optional.of(DeviceId.deviceId(dstArray[0])), Optional.of(PortNumber.portNumber(dstArray[1])), null, OpticalTunnelEndPoint.Type.TIMESLOT, OpticalLogicId.logicId(0), true);
    } else {
        print("Illegal tunnel type. Please input MPLS, VLAN, VXLAN, GRE, ODUK or OCH.");
        return;
    }
    SparseAnnotations annotations = DefaultAnnotations.builder().set("bandwidth", bandwidth == null || "".equals(bandwidth) ? "0" : bandwidth).build();
    TunnelDescription tunnel = new DefaultTunnelDescription(null, srcPoint, dstPoint, trueType, new GroupId(Integer.parseInt(groupId)), producerName, TunnelName.tunnelName(tunnelName), null, annotations);
    TunnelId tunnelId = service.tunnelAdded(tunnel);
    if (tunnelId == null) {
        error("Create tunnel failed.");
        return;
    }
    print(FMT, tunnelId.id());
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) TunnelProvider(org.onosproject.incubator.net.tunnel.TunnelProvider) OpticalTunnelEndPoint(org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint) TunnelEndPoint(org.onosproject.incubator.net.tunnel.TunnelEndPoint) DefaultOpticalTunnelEndPoint(org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint) IpTunnelEndPoint(org.onosproject.incubator.net.tunnel.IpTunnelEndPoint) TunnelDescription(org.onosproject.incubator.net.tunnel.TunnelDescription) DefaultTunnelDescription(org.onosproject.incubator.net.tunnel.DefaultTunnelDescription) TunnelId(org.onosproject.incubator.net.tunnel.TunnelId) GroupId(org.onosproject.core.GroupId) SparseAnnotations(org.onosproject.net.SparseAnnotations) Tunnel(org.onosproject.incubator.net.tunnel.Tunnel) DefaultOpticalTunnelEndPoint(org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint) DefaultTunnelDescription(org.onosproject.incubator.net.tunnel.DefaultTunnelDescription)

Example 44 with GroupId

use of org.onosproject.core.GroupId in project onos by opennetworkinglab.

the class VirtualNetworkGroupManagerTest method testAuditWithExtraneousMissingGroups.

// Test AUDIT process with extraneous groups and missing groups
private void testAuditWithExtraneousMissingGroups(NetworkId networkId, DeviceId deviceId) {
    VirtualNetworkGroupManager groupManager;
    VirtualGroupProviderService providerService;
    if (networkId.id() == 1) {
        groupManager = groupManager1;
        providerService = providerService1;
    } else {
        groupManager = groupManager2;
        providerService = providerService2;
    }
    PortNumber[] ports1 = { PortNumber.portNumber(31), PortNumber.portNumber(32) };
    PortNumber[] ports2 = { PortNumber.portNumber(41), PortNumber.portNumber(42) };
    GroupId gId1 = new GroupId(1);
    Group group1 = createSouthboundGroupEntry(gId1, Arrays.asList(ports1), 0, deviceId);
    GroupId gId2 = new GroupId(2);
    Group group2 = createSouthboundGroupEntry(gId2, Arrays.asList(ports2), 0, deviceId);
    List<Group> groupEntries = Arrays.asList(group1, group2);
    providerService.pushGroupMetrics(deviceId, groupEntries);
    GroupKey key = new DefaultGroupKey("group1BeforeAudit".getBytes());
    Group createdGroup = groupManager.getGroup(deviceId, key);
    List<GroupOperation> expectedGroupOps = Arrays.asList(GroupOperation.createDeleteGroupOperation(gId1, Group.Type.SELECT), GroupOperation.createDeleteGroupOperation(gId2, Group.Type.SELECT), GroupOperation.createAddGroupOperation(createdGroup.id(), Group.Type.SELECT, createdGroup.buckets()));
    if (deviceId.equals(VDID1)) {
        provider.validate(networkId, deviceId, expectedGroupOps);
    }
}
Also used : VirtualGroupProviderService(org.onosproject.incubator.net.virtual.provider.VirtualGroupProviderService) DefaultGroup(org.onosproject.net.group.DefaultGroup) Group(org.onosproject.net.group.Group) GroupKey(org.onosproject.net.group.GroupKey) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) PortNumber(org.onosproject.net.PortNumber) GroupOperation(org.onosproject.net.group.GroupOperation) GroupId(org.onosproject.core.GroupId)

Example 45 with GroupId

use of org.onosproject.core.GroupId in project onos by opennetworkinglab.

the class SimpleVirtualGroupStore method addOrUpdateExtraneousGroupEntry.

@Override
public void addOrUpdateExtraneousGroupEntry(NetworkId networkId, Group group) {
    ConcurrentMap<GroupId, Group> extraneousIdTable = getExtraneousGroupIdTable(networkId, group.deviceId());
    extraneousIdTable.put(group.id(), group);
    // Check the reference counter
    if (group.referenceCount() == 0) {
        notifyDelegate(networkId, new GroupEvent(GroupEvent.Type.GROUP_REMOVE_REQUESTED, group));
    }
}
Also used : DefaultGroup(org.onosproject.net.group.DefaultGroup) Group(org.onosproject.net.group.Group) GroupEvent(org.onosproject.net.group.GroupEvent) GroupId(org.onosproject.core.GroupId)

Aggregations

GroupId (org.onosproject.core.GroupId)59 GroupBucket (org.onosproject.net.group.GroupBucket)30 GroupKey (org.onosproject.net.group.GroupKey)29 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)26 GroupBuckets (org.onosproject.net.group.GroupBuckets)26 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)25 DefaultGroupBucket (org.onosproject.net.group.DefaultGroupBucket)24 DefaultGroupKey (org.onosproject.net.group.DefaultGroupKey)21 DefaultGroupDescription (org.onosproject.net.group.DefaultGroupDescription)19 GroupDescription (org.onosproject.net.group.GroupDescription)19 DefaultGroup (org.onosproject.net.group.DefaultGroup)18 Group (org.onosproject.net.group.Group)17 GroupEvent (org.onosproject.net.group.GroupEvent)12 ArrayList (java.util.ArrayList)11 PortNumber (org.onosproject.net.PortNumber)11 Instruction (org.onosproject.net.flow.instructions.Instruction)10 L2ModificationInstruction (org.onosproject.net.flow.instructions.L2ModificationInstruction)10 StoredGroupEntry (org.onosproject.net.group.StoredGroupEntry)10 OfdpaGroupHandlerUtility.l2MulticastGroupKey (org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility.l2MulticastGroupKey)9 MacAddress (org.onlab.packet.MacAddress)8