本文整理汇总了Java中org.onosproject.net.DeviceId类的典型用法代码示例。如果您正苦于以下问题:Java DeviceId类的具体用法?Java DeviceId怎么用?Java DeviceId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeviceId类属于org.onosproject.net包,在下文中一共展示了DeviceId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: filterObjBuilder
import org.onosproject.net.DeviceId; //导入依赖的package包/类
/**
* Creates a filtering objective builder for multicast.
*
* @param deviceId Device ID
* @param ingressPort ingress port of the multicast stream
* @param assignedVlan assigned VLAN ID
* @return filtering objective builder
*/
private FilteringObjective.Builder filterObjBuilder(DeviceId deviceId, PortNumber ingressPort,
VlanId assignedVlan) {
FilteringObjective.Builder filtBuilder = DefaultFilteringObjective.builder();
filtBuilder.withKey(Criteria.matchInPort(ingressPort))
.addCondition(Criteria.matchEthDstMasked(MacAddress.IPV4_MULTICAST,
MacAddress.IPV4_MULTICAST_MASK))
.addCondition(Criteria.matchVlanId(egressVlan()))
.withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
// vlan assignment is valid only if this instance is master
if (srManager.mastershipService.isLocalMaster(deviceId)) {
TrafficTreatment tt = DefaultTrafficTreatment.builder()
.pushVlan().setVlanId(assignedVlan).build();
filtBuilder.withMeta(tt);
}
return filtBuilder.permit().fromApp(srManager.appId);
}
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:McastHandler.java
示例2: decode
import org.onosproject.net.DeviceId; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* Note: Result of {@link Port#element()} returned Port object,
* is not a full Device object.
* Only it's DeviceId can be used.
*/
@Override
public Port decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
DeviceId did = DeviceId.deviceId(json.get(ELEMENT).asText());
Device device = new DummyDevice(did);
PortNumber number = portNumber(json.get(PORT_NAME).asText());
boolean isEnabled = json.get(IS_ENABLED).asBoolean();
Type type = Type.valueOf(json.get(TYPE).asText().toUpperCase());
long portSpeed = json.get(PORT_SPEED).asLong();
Annotations annotations = extractAnnotations(json, context);
return new DefaultPort(device, number, isEnabled, type, portSpeed, annotations);
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:PortCodec.java
示例3: updatePorts
import org.onosproject.net.DeviceId; //导入依赖的package包/类
@Override
public void updatePorts(DeviceId deviceId,
List<PortDescription> portDescriptions) {
checkNotNull(deviceId, DEVICE_ID_NULL);
checkNotNull(portDescriptions, PORT_DESC_LIST_NULL);
checkValidity();
if (!mastershipService.isLocalMaster(deviceId)) {
// Never been a master for this device
// any update will be ignored.
log.trace("Ignoring {} port updates on standby node. {}", deviceId, portDescriptions);
return;
}
portDescriptions = portDescriptions.stream()
.map(e -> consolidate(deviceId, e))
.map(this::ensureGeneric)
.collect(Collectors.toList());
List<DeviceEvent> events = store.updatePorts(this.provider().id(),
deviceId, portDescriptions);
if (events != null) {
for (DeviceEvent event : events) {
post(event);
}
}
}
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:DeviceManager.java
示例4: inSameSubnet
import org.onosproject.net.DeviceId; //导入依赖的package包/类
/**
* Checks if the host is in the subnet defined in the router with the
* device ID given.
*
* @param deviceId device identification of the router
* @param hostIp host IP address to check
* @return true if the host is within the subnet of the router,
* false if no subnet is defined under the router or if the host is not
* within the subnet defined in the router
*/
public boolean inSameSubnet(DeviceId deviceId, Ip4Address hostIp) {
Set<Ip4Prefix> subnets = getSubnets(deviceId);
if (subnets == null) {
return false;
}
for (Ip4Prefix subnet: subnets) {
// Exclude /0 since it is a special case used for default route
if (subnet.prefixLength() != 0 && subnet.contains(hostIp)) {
return true;
}
}
return false;
}
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:DeviceConfiguration.java
示例5: programRules
import org.onosproject.net.DeviceId; //导入依赖的package包/类
@Override
public void programRules(DeviceId deviceId, IpAddress dstIp,
MacAddress ethSrc, IpAddress ipDst,
SegmentationId actionVni, Objective.Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
.matchIPDst(IpPrefix.valueOf(dstIp, PREFIX_LENGTH)).build();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
treatment.setEthSrc(ethSrc).setIpDst(ipDst)
.setTunnelId(Long.parseLong(actionVni.segmentationId()));
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment.build())
.withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(DNAT_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
log.debug("RouteRules-->ADD");
flowObjectiveService.forward(deviceId, objective.add());
} else {
log.debug("RouteRules-->REMOVE");
flowObjectiveService.forward(deviceId, objective.remove());
}
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:DnatServiceImpl.java
示例6: testConstruction
import org.onosproject.net.DeviceId; //导入依赖的package包/类
/**
* Checks the construction of a PceccTunnelInfo object.
*/
@Test
public void testConstruction() {
List<LspLocalLabelInfo> lspLocalLabelInfoList = new LinkedList<>();
ResourceConsumer tunnelConsumerId = TunnelConsumerId.valueOf(10);
// create object of DefaultLspLocalLabelInfo
DeviceId deviceId = DeviceId.deviceId("foo");
LabelResourceId inLabelId = LabelResourceId.labelResourceId(1);
LabelResourceId outLabelId = LabelResourceId.labelResourceId(2);
PortNumber inPort = PortNumber.portNumber(5122);
PortNumber outPort = PortNumber.portNumber(5123);
LspLocalLabelInfo lspLocalLabelInfo = DefaultLspLocalLabelInfo.builder()
.deviceId(deviceId)
.inLabelId(inLabelId)
.outLabelId(outLabelId)
.inPort(inPort)
.outPort(outPort)
.build();
lspLocalLabelInfoList.add(lspLocalLabelInfo);
PceccTunnelInfo pceccTunnelInfo = new PceccTunnelInfo(lspLocalLabelInfoList, tunnelConsumerId);
assertThat(lspLocalLabelInfoList, is(pceccTunnelInfo.lspLocalLabelInfoList()));
}
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:PceccTunnelInfoTest.java
示例7: deleteGroupDescriptionInternal
import org.onosproject.net.DeviceId; //导入依赖的package包/类
private void deleteGroupDescriptionInternal(DeviceId deviceId,
GroupKey appCookie) {
// Check if a group is existing with the provided key
StoredGroupEntry existing = getStoredGroupEntry(deviceId, appCookie);
if (existing == null) {
return;
}
log.debug("deleteGroupDescriptionInternal: group entry {} in device {} moving from {} to PENDING_DELETE",
existing.id(),
existing.deviceId(),
existing.state());
synchronized (existing) {
existing.setState(GroupState.PENDING_DELETE);
getGroupStoreKeyMap().
put(new GroupStoreKeyMapKey(existing.deviceId(), existing.appCookie()),
existing);
}
log.debug("deleteGroupDescriptionInternal: in device {} issuing GROUP_REMOVE_REQUESTED",
deviceId);
notifyDelegate(new GroupEvent(Type.GROUP_REMOVE_REQUESTED, existing));
}
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:DistributedGroupStore.java
示例8: setupMockMeters
import org.onosproject.net.DeviceId; //导入依赖的package包/类
/**
* Populates some meters used as testing data.
*/
private void setupMockMeters() {
final Set<Meter> meters1 = new HashSet<>();
meters1.add(meter1);
meters1.add(meter2);
final Set<Meter> meters2 = new HashSet<>();
meters2.add(meter3);
meters2.add(meter4);
meters.put(deviceId1, meters1);
meters.put(deviceId2, meters2);
Set<Meter> allMeters = new HashSet<>();
for (DeviceId deviceId : meters.keySet()) {
allMeters.addAll(meters.get(deviceId));
}
expect(mockMeterService.getAllMeters()).andReturn(allMeters).anyTimes();
}
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:MetersResourceTest.java
示例9: testConfiguredLink
import org.onosproject.net.DeviceId; //导入依赖的package包/类
/**
* Tests discovery of an expected link.
*/
@Test
public void testConfiguredLink() {
LinkKey key = LinkKey.linkKey(src, dst);
configListener.event(new NetworkConfigEvent(NetworkConfigEvent.Type.CONFIG_ADDED,
key,
BasicLinkConfig.class));
PacketContext pktCtx = new TestPacketContext(src, dst);
testProcessor.process(pktCtx);
assertThat(providerService.discoveredLinks().entrySet(), hasSize(1));
DeviceId destination = providerService.discoveredLinks().get(dev1.id());
assertThat(destination, notNullValue());
LinkDescription linkDescription = providerService
.discoveredLinkDescriptions().get(key);
assertThat(linkDescription, notNullValue());
assertThat(linkDescription.isExpected(), is(true));
}
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:NetworkConfigLinksProviderTest.java
示例10: programExternalOut
import org.onosproject.net.DeviceId; //导入依赖的package包/类
@Override
public void programExternalOut(DeviceId deviceId,
SegmentationId segmentationId,
PortNumber outPort, MacAddress sourceMac,
Objective.Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchTunnelId(Long.parseLong(segmentationId.toString()))
.matchEthSrc(sourceMac).build();
TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.setOutput(outPort).build();
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment).withSelector(selector)
.fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(MAC_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
flowObjectiveService.forward(deviceId, objective.add());
} else {
flowObjectiveService.forward(deviceId, objective.remove());
}
}
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:L2ForwardServiceImpl.java
示例11: markOffline
import org.onosproject.net.DeviceId; //导入依赖的package包/类
@Override
public DeviceEvent markOffline(DeviceId deviceId) {
Map<ProviderId, DeviceDescriptions> providerDescs
= getOrCreateDeviceDescriptions(deviceId);
// locking device
synchronized (providerDescs) {
Device device = devices.get(deviceId);
if (device == null) {
return null;
}
boolean removed = availableDevices.remove(deviceId);
if (removed) {
// TODO: broadcast ... DOWN only?
return new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, device, null);
}
return null;
}
}
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:SimpleDeviceStore.java
示例12: enforceRuleAdding
import org.onosproject.net.DeviceId; //导入依赖的package包/类
/**
* Enforces denying ACL rule by ACL flow rules.
*/
private void enforceRuleAdding(AclRule rule) {
Set<DeviceId> dpidSet;
if (rule.srcIp() != null) {
dpidSet = getDeviceIdSet(rule.srcIp());
} else {
dpidSet = getDeviceIdSet(rule.dstIp());
}
for (DeviceId deviceId : dpidSet) {
List<RuleId> allowingRuleList = aclStore.getAllowingRuleByDenyingRule(rule.id());
if (allowingRuleList != null) {
for (RuleId allowingRuleId : allowingRuleList) {
generateAclFlow(aclStore.getAclRule(allowingRuleId), deviceId);
}
}
generateAclFlow(rule, deviceId);
}
}
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:AclManager.java
示例13: programSnatDiffSegmentRules
import org.onosproject.net.DeviceId; //导入依赖的package包/类
@Override
public void programSnatDiffSegmentRules(DeviceId deviceId, SegmentationId matchVni,
IpAddress srcIP, MacAddress ethDst,
MacAddress ethSrc, IpAddress ipSrc,
SegmentationId actionVni, Objective.Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
.matchTunnelId(Long.parseLong(matchVni.segmentationId()))
.matchIPSrc(IpPrefix.valueOf(srcIP, PREFIC_LENGTH)).build();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
treatment.setEthDst(ethDst).setEthSrc(ethSrc).setIpSrc(ipSrc)
.setTunnelId(Long.parseLong(actionVni.segmentationId()));
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment.build())
.withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(SNAT_DIFF_SEG_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
flowObjectiveService.forward(deviceId, objective.add());
} else {
flowObjectiveService.forward(deviceId, objective.remove());
}
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:SnatServiceImpl.java
示例14: createHost
import org.onosproject.net.DeviceId; //导入依赖的package包/类
private Host createHost() {
MacAddress mac = MacAddress.valueOf("00:00:11:00:00:01");
VlanId vlan = VlanId.vlanId((short) 10);
HostLocation loc = new HostLocation(
DeviceId.deviceId("of:foo"),
PortNumber.portNumber(100),
123L
);
Set<IpAddress> ipset = Sets.newHashSet(
IpAddress.valueOf("10.0.0.1"),
IpAddress.valueOf("10.0.0.2")
);
HostId hid = HostId.hostId(mac, vlan);
return new DefaultHost(
new ProviderId("of", "foo"), hid, mac, vlan, loc, ipset);
}
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:HostEventTest.java
示例15: activate
import org.onosproject.net.DeviceId; //导入依赖的package包/类
@Activate
public void activate() {
appId = coreService.registerApplication("org.onosproject.mplsfwd");
uglyMap.put(DeviceId.deviceId("of:0000000000000001"), 1);
uglyMap.put(DeviceId.deviceId("of:0000000000000002"), 2);
uglyMap.put(DeviceId.deviceId("of:0000000000000003"), 3);
deviceService.addListener(listener);
for (Device d : deviceService.getDevices()) {
pushRules(d);
}
log.info("Started with Application ID {}", appId.id());
}
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:MplsForwarding.java
示例16: getFreeGroupIdValue
import org.onosproject.net.DeviceId; //导入依赖的package包/类
private int getFreeGroupIdValue(DeviceId deviceId) {
int freeId = groupIdGen.incrementAndGet();
while (true) {
Group existing = getGroup(deviceId, new DefaultGroupId(freeId));
if (existing == null) {
existing = (
extraneousGroupEntriesById.get(deviceId) != null) ?
extraneousGroupEntriesById.get(deviceId).
get(new DefaultGroupId(freeId)) :
null;
}
if (existing != null) {
freeId = groupIdGen.incrementAndGet();
} else {
break;
}
}
log.debug("getFreeGroupIdValue: Next Free ID is {}", freeId);
return freeId;
}
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:DistributedGroupStore.java
示例17: queryBandwidth
import org.onosproject.net.DeviceId; //导入依赖的package包/类
/**
* Query bandwidth capacity on a port.
*
* @param did {@link DeviceId}
* @param number {@link PortNumber}
* @return bandwidth capacity
*/
private Optional<Bandwidth> queryBandwidth(DeviceId did, PortNumber number) {
// Check and use netcfg first.
ConnectPoint cp = new ConnectPoint(did, number);
BandwidthCapacity config = netcfgService.getConfig(cp, BandwidthCapacity.class);
if (config != null) {
log.trace("Registering configured bandwidth {} for {}/{}", config.capacity(), did, number);
return Optional.of(config.capacity());
}
// populate bandwidth value, assuming portSpeed == bandwidth
Port port = deviceService.getPort(did, number);
if (port != null) {
return Optional.of(Bandwidth.mbps(port.portSpeed()));
}
return Optional.empty();
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:ResourceDeviceListener.java
示例18: removeGroupFromDevice
import org.onosproject.net.DeviceId; //导入依赖的package包/类
/**
* Removes entire group on given device.
*
* @param deviceId device ID
* @param mcastIp multicast group to be removed
* @param assignedVlan assigned VLAN ID
*/
private void removeGroupFromDevice(DeviceId deviceId, IpAddress mcastIp,
VlanId assignedVlan) {
McastStoreKey mcastStoreKey = new McastStoreKey(mcastIp, deviceId);
// This device is not serving this multicast group
if (!mcastNextObjStore.containsKey(mcastStoreKey)) {
log.warn("{} is not serving {}. Abort.", deviceId, mcastIp);
return;
}
NextObjective nextObj = mcastNextObjStore.get(mcastStoreKey).value();
// NOTE: Rely on GroupStore garbage collection rather than explicitly
// remove L3MG since there might be other flows/groups refer to
// the same L2IG
ObjectiveContext context = new DefaultObjectiveContext(
(objective) -> log.debug("Successfully remove {} on {}, vlan {}",
mcastIp, deviceId, assignedVlan),
(objective, error) ->
log.warn("Failed to remove {} on {}, vlan {}: {}",
mcastIp, deviceId, assignedVlan, error));
ForwardingObjective fwdObj = fwdObjBuilder(mcastIp, assignedVlan, nextObj.id()).remove(context);
srManager.flowObjectiveService.forward(deviceId, fwdObj);
mcastNextObjStore.remove(mcastStoreKey);
mcastRoleStore.remove(mcastStoreKey);
}
开发者ID:shlee89,项目名称:athena,代码行数:31,代码来源:McastHandler.java
示例19: createOrUpdateDevice
import org.onosproject.net.DeviceId; //导入依赖的package包/类
@Override
public DeviceEvent createOrUpdateDevice(ProviderId providerId,
DeviceId deviceId,
DeviceDescription deviceDescription) {
NodeId master = mastershipService.getMasterFor(deviceId);
if (localNodeId.equals(master)) {
deviceDescriptions.put(new DeviceKey(providerId, deviceId), deviceDescription);
return refreshDeviceCache(providerId, deviceId);
} else {
// Only forward for ConfigProvider
// Forwarding was added as a workaround for ONOS-490
if (!providerId.scheme().equals("cfg")) {
return null;
}
DeviceInjectedEvent deviceInjectedEvent = new DeviceInjectedEvent(providerId, deviceId, deviceDescription);
return Futures.getUnchecked(
clusterCommunicator.sendAndReceive(deviceInjectedEvent,
DEVICE_INJECTED,
SERIALIZER::encode,
SERIALIZER::decode,
master));
}
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:ECDeviceStore.java
示例20: getClassifiers
import org.onosproject.net.DeviceId; //导入依赖的package包/类
/**
* Get the list of classifier devices.
*
* @return 200 OK
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response getClassifiers() {
ObjectNode result = mapper().createObjectNode();
Iterable<DeviceId> classifierDevices = get(ClassifierService.class).getClassifiers();
ArrayNode classifier = result.putArray("classifiers");
if (classifierDevices != null) {
for (final DeviceId deviceId : classifierDevices) {
ObjectNode dev = mapper().createObjectNode()
.put("DeviceId", deviceId.toString());
classifier.add(dev);
}
}
return ok(result.toString()).build();
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:ClassifierWebResource.java
注:本文中的org.onosproject.net.DeviceId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论