Java Code Examples for org.onosproject.net.ConnectPoint#port()

The following examples show how to use org.onosproject.net.ConnectPoint#port() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IsisTopologyProvider.java    From onos with Apache License 2.0 6 votes vote down vote up
@Override
public void addLink(IsisLink isisLink) {
    log.debug("Addlink {}", isisLink.localSystemId());

    LinkDescription linkDes = buildLinkDes(isisLink);
    //Updating ports of the link
    //If already link exists, return
    if (linkService.getLink(linkDes.src(), linkDes.dst()) != null || linkProviderService == null) {
        return;
    }
    ConnectPoint destconnectPoint = linkDes.dst();
    PortNumber destport = destconnectPoint.port();
    if (destport.toLong() != 0) {
        deviceProviderService.updatePorts(linkDes.src().deviceId(),
                                          buildPortDescriptions(linkDes.src().deviceId(),
                                          linkDes.src().port()));
        deviceProviderService.updatePorts(linkDes.dst().deviceId(),
                                          buildPortDescriptions(linkDes.dst().deviceId(),
                                          linkDes.dst().port()));
        registerBandwidth(linkDes, isisLink);
        linkProviderService.linkDetected(linkDes);
        System.out.println("link desc " + linkDes.toString());
    }
}
 
Example 2
Source File: VplsIntentUtility.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Builds an intent key either for single-point to multi-point or
 * multi-point to single-point intents, based on a prefix that defines
 * the type of intent, the single connect point representing the single
 * source or destination for that intent, the name of the VPLS the intent
 * belongs to, and the destination host MAC address the intent reaches.
 *
 * @param prefix the key prefix
 * @param cPoint the connect point identifying the source/destination
 * @param vplsName the name of the VPLS
 * @param hostMac the source/destination MAC address
 * @param appId application ID for the key
 * @return the key to identify the intent
 */
static Key buildKey(String prefix,
                              ConnectPoint cPoint,
                              String vplsName,
                              MacAddress hostMac,
                              ApplicationId appId) {
    String keyString = vplsName +
            SEPARATOR +
            prefix +
            SEPARATOR +
            cPoint.deviceId() +
            SEPARATOR +
            cPoint.port() +
            SEPARATOR +
            hostMac;

    return Key.of(keyString, appId);
}
 
Example 3
Source File: VplsIntentTest.java    From onos with Apache License 2.0 6 votes vote down vote up
/**
 * Builds an intent Key either for a single-point to multi-point or
 * multi-point to single-point intent, based on a prefix that defines
 * the intent type, the connection point representing the source or the
 * destination and the VLAN Id representing the VPLS.
 *
 * @param prefix the key prefix
 * @param cPoint the ingress/egress connect point
 * @param vplsName the VPLS name
 * @param hostMac the ingress/egress MAC address
 * @return the key to identify the intent
 */
private Key buildKey(String prefix,
                     ConnectPoint cPoint,
                     String vplsName,
                     MacAddress hostMac) {
    String keyString = vplsName +
            DASH +
            prefix +
            DASH +
            cPoint.deviceId() +
            DASH +
            cPoint.port() +
            DASH +
            hostMac;

    return Key.of(keyString, APPID);
}
 
Example 4
Source File: PortAuthTracker.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Radius has authorized the supplicant at this connect point. If
 * we are tracking this port, clear the blocking flow and mark the
 * port as authorized.
 *
 * @param connectPoint supplicant connect point
 */
void radiusAuthorize(ConnectPoint connectPoint) {
    DeviceId d = connectPoint.deviceId();
    PortNumber p = connectPoint.port();
    if (configured(d, p)) {
        clearBlockingFlow(d, p);
        markAsAuthenticated(d, p);
    }
}
 
Example 5
Source File: PortAuthTracker.java    From onos with Apache License 2.0 5 votes vote down vote up
/**
 * Supplicant at specified connect point has logged off Radius. If
 * we are tracking this port, install a blocking flow and mark the
 * port as blocked.
 *
 * @param connectPoint supplicant connect point
 */
void radiusLogoff(ConnectPoint connectPoint) {
    DeviceId d = connectPoint.deviceId();
    PortNumber p = connectPoint.port();
    if (configured(d, p)) {
        installBlockingFlow(d, p);
        markAsBlocked(d, p);
    }
}
 
Example 6
Source File: UiLinkId.java    From onos with Apache License 2.0 5 votes vote down vote up
private static UiLinkId canonicalizeIdentifier(ConnectPoint src, ConnectPoint dst) {
    if (src == null || dst == null) {
        throw new NullPointerException(
                "null src or dst connect point (illegal for UiLinkId)");
    }
    ElementId srcId = src.elementId();
    ElementId dstId = dst.elementId();

    // canonicalize
    int comp = srcId.toString().compareTo(dstId.toString());
    return comp <= 0 ? new UiLinkId(srcId, src.port(), dstId, dst.port())
            : new UiLinkId(dstId, dst.port(), srcId, src.port());
}
 
Example 7
Source File: OpticalPathProvisionerTest.java    From onos with Apache License 2.0 4 votes vote down vote up
private static Port createPacketPort(Device device, ConnectPoint cp) {
    return new DefaultPort(device, cp.port(), true);
}
 
Example 8
Source File: OpticalPathProvisionerTest.java    From onos with Apache License 2.0 4 votes vote down vote up
private static Port createOchPort(Device device, ConnectPoint cp) {
    return new DefaultOchPort(new DefaultPort(device, cp.port(), true),
            OduSignalType.ODU4,
            true,
            OchSignal.newDwdmSlot(ChannelSpacing.CHL_50GHZ, 1));
}
 
Example 9
Source File: OpticalPathProvisionerTest.java    From onos with Apache License 2.0 4 votes vote down vote up
private static Port createOduCltPort(Device device, ConnectPoint cp) {
    return new DefaultOduCltPort(new DefaultPort(device, cp.port(), true),
            CltSignalType.CLT_100GBE);
}
 
Example 10
Source File: OpticalPathProvisionerTest.java    From onos with Apache License 2.0 4 votes vote down vote up
private static Port createOmsPort(Device device, ConnectPoint cp) {
    return new DefaultOmsPort(new DefaultPort(device, cp.port(), true),
            Frequency.ofKHz(3),
            Frequency.ofKHz(33),
            Frequency.ofKHz(2));
}
 
Example 11
Source File: DefaultVirtualFlowRuleProvider.java    From onos with Apache License 2.0 4 votes vote down vote up
/**
 * Translate the requested virtual flow rules into physical flow rules.
 * The translation could be one to many.
 *
 * @param flowRule A flow rule from underlying data plane to be translated
 * @return A set of flow rules for physical network
 */
private Set<FlowRule> devirtualize(NetworkId networkId, FlowRule flowRule) {

    Set<FlowRule> outRules = new HashSet<>();

    Set<ConnectPoint> ingressPoints = extractIngressPoints(networkId,
                                                           flowRule.deviceId(),
                                                           flowRule.selector());

    ConnectPoint egressPoint = extractEgressPoints(networkId,
                                                     flowRule.deviceId(),
                                                     flowRule.treatment());

    if (egressPoint == null) {
        return outRules;
    }

    TrafficSelector.Builder commonSelectorBuilder
            = DefaultTrafficSelector.builder();
    flowRule.selector().criteria().stream()
            .filter(c -> c.type() != Criterion.Type.IN_PORT)
            .forEach(c -> commonSelectorBuilder.add(c));
    TrafficSelector commonSelector = commonSelectorBuilder.build();

    TrafficTreatment.Builder commonTreatmentBuilder
            = DefaultTrafficTreatment.builder();
    flowRule.treatment().allInstructions().stream()
            .filter(i -> i.type() != Instruction.Type.OUTPUT)
            .forEach(i -> commonTreatmentBuilder.add(i));
    TrafficTreatment commonTreatment = commonTreatmentBuilder.build();

    for (ConnectPoint ingressPoint : ingressPoints) {
        if (egressPoint.port() == PortNumber.FLOOD) {
            Set<ConnectPoint> outPoints = vnService
                    .getVirtualPorts(networkId, flowRule.deviceId())
                    .stream()
                    .map(VirtualPort::realizedBy)
                    .filter(p -> !p.equals(ingressPoint))
                    .collect(Collectors.toSet());

            for (ConnectPoint outPoint : outPoints) {
                outRules.addAll(generateRules(networkId, ingressPoint, outPoint,
                                              commonSelector, commonTreatment, flowRule));
            }
        } else {
            outRules.addAll(generateRules(networkId, ingressPoint, egressPoint,
                                          commonSelector, commonTreatment, flowRule));
        }
    }

    return outRules;
}
 
Example 12
Source File: TroubleshootManagerTest.java    From onos with Apache License 2.0 4 votes vote down vote up
@Override
public Port getPort(ConnectPoint cp) {
    return new DefaultPort(null, cp.port(), true, DefaultAnnotations.builder().build());
}
 
Example 13
Source File: ConnectPointFormatter.java    From onos with Apache License 2.0 4 votes vote down vote up
@Override
protected String nonNullFormat(Object value) {
    ConnectPoint cp = (ConnectPoint) value;
    return cp.elementId() + SLASH + cp.port();
}
 
Example 14
Source File: SubjectFactories.java    From onos with Apache License 2.0 4 votes vote down vote up
private static String key(ConnectPoint subject) {
    return subject.deviceId() + "/" + subject.port();
}