本文整理汇总了Java中org.onosproject.vtnrsc.SegmentationId类的典型用法代码示例。如果您正苦于以下问题:Java SegmentationId类的具体用法?Java SegmentationId怎么用?Java SegmentationId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SegmentationId类属于org.onosproject.vtnrsc包,在下文中一共展示了SegmentationId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendEastWestL3Flows
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的package包/类
private void sendEastWestL3Flows(Host h, MacAddress srcVmGwMac,
SegmentationId l3vni, IpAddress srcGwIp,
TenantNetwork network, IpAddress dstVmIP,
MacAddress dstVmGwMac,
Objective.Operation operation) {
classifierService
.programL3InPortClassifierRules(h.location().deviceId(),
h.location().port(), h.mac(),
srcVmGwMac, l3vni, operation);
classifierService
.programArpClassifierRules(h.location().deviceId(),
h.location().port(), srcGwIp,
network.segmentationId(), operation);
Iterable<Device> devices = deviceService.getAvailableDevices();
Sets.newHashSet(devices).stream()
.filter(d -> Device.Type.SWITCH == d.type()).forEach(d -> {
// L3FWD rules
l3ForwardService.programRouteRules(d.id(), l3vni, dstVmIP,
network.segmentationId(),
dstVmGwMac, h.mac(),
operation);
});
}
示例2: sendNorthSouthL3Flows
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的package包/类
private void sendNorthSouthL3Flows(DeviceId deviceId, FloatingIp floatingIp,
IpAddress dstVmGwIp,
MacAddress dstVmGwMac,
SegmentationId l3vni,
TenantNetwork vmNetwork,
VirtualPort vmPort, Host host,
Objective.Operation operation) {
l3ForwardService
.programRouteRules(deviceId, l3vni, floatingIp.fixedIp(),
vmNetwork.segmentationId(), dstVmGwMac,
vmPort.macAddress(), operation);
classifierService.programL3InPortClassifierRules(deviceId,
host.location().port(),
host.mac(), dstVmGwMac,
l3vni, operation);
classifierService.programArpClassifierRules(deviceId, host.location()
.port(), dstVmGwIp, vmNetwork.segmentationId(), operation);
}
示例3: programRules
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的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());
}
}
示例4: programLocalIn
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的package包/类
@Override
public void programLocalIn(DeviceId deviceId,
SegmentationId segmentationId, PortNumber inPort,
MacAddress srcMac, ApplicationId appid,
Objective.Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchInPort(inPort).matchEthSrc(srcMac).build();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
treatment.add(Instructions
.modTunnelId(Long.parseLong(segmentationId.toString())));
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment.build())
.withSelector(selector).fromApp(appId).makePermanent()
.withFlag(Flag.SPECIFIC).withPriority(L2_CLASSIFIER_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
log.debug("programLocalIn-->ADD");
flowObjectiveService.forward(deviceId, objective.add());
} else {
log.debug("programLocalIn-->REMOVE");
flowObjectiveService.forward(deviceId, objective.remove());
}
}
示例5: programL3InPortClassifierRules
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的package包/类
@Override
public void programL3InPortClassifierRules(DeviceId deviceId, PortNumber inPort,
MacAddress srcMac, MacAddress dstMac,
SegmentationId actionVni,
Objective.Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchInPort(inPort).matchEthSrc(srcMac).matchEthDst(dstMac)
.build();
TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.setTunnelId(Long.parseLong(actionVni.segmentationId())).build();
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment).withSelector(selector)
.fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(L3_CLASSIFIER_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
log.debug("L3InternalClassifierRules-->ADD");
flowObjectiveService.forward(deviceId, objective.add());
} else {
log.debug("L3InternalClassifierRules-->REMOVE");
flowObjectiveService.forward(deviceId, objective.remove());
}
}
示例6: programArpClassifierRules
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的package包/类
@Override
public void programArpClassifierRules(DeviceId deviceId, IpAddress dstIp,
SegmentationId actionVni,
Objective.Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthType(ETH_TYPE.ethType().toShort())
.matchArpTpa(Ip4Address.valueOf(dstIp.toString()))
.build();
TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.setTunnelId(Long.parseLong(actionVni.segmentationId()))
.build();
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment).withSelector(selector)
.fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(ARP_CLASSIFIER_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
log.debug("ArpClassifierRules-->ADD");
flowObjectiveService.forward(deviceId, objective.add());
} else {
log.debug("ArpClassifierRules-->REMOVE");
flowObjectiveService.forward(deviceId, objective.remove());
}
}
示例7: programUserdataClassifierRules
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的package包/类
@Override
public void programUserdataClassifierRules(DeviceId deviceId,
IpPrefix ipPrefix,
IpAddress dstIp,
MacAddress dstmac,
SegmentationId actionVni,
Objective.Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4).matchIPSrc(ipPrefix)
.matchIPDst(IpPrefix.valueOf(dstIp, 32)).build();
TrafficTreatment treatment = DefaultTrafficTreatment.builder()
.setTunnelId(Long.parseLong(actionVni.segmentationId()))
.setEthDst(dstmac).build();
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment).withSelector(selector)
.fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(USERDATA_CLASSIFIER_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
log.debug("UserdataClassifierRules-->ADD");
flowObjectiveService.forward(deviceId, objective.add());
} else {
log.debug("UserdataClassifierRules-->REMOVE");
flowObjectiveService.forward(deviceId, objective.remove());
}
}
示例8: programLocalOut
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的package包/类
@Override
public void programLocalOut(DeviceId deviceId,
SegmentationId segmentationId,
PortNumber outPort, MacAddress sourceMac,
Objective.Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchTunnelId(Long.parseLong(segmentationId.toString()))
.matchEthDst(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());
}
}
示例9: programExternalOut
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的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());
}
}
示例10: programRouteRules
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的package包/类
@Override
public void programRouteRules(DeviceId deviceId, SegmentationId l3Vni,
IpAddress dstVmIP, SegmentationId dstVni,
MacAddress dstVmGwMac, MacAddress dstVmMac,
Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthType(IP_TYPE)
.matchTunnelId(Long.parseLong(l3Vni.segmentationId()))
.matchIPDst(IpPrefix.valueOf(dstVmIP, PREFIX_LENGTH)).build();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
treatment.setEthSrc(dstVmGwMac)
.setEthDst(dstVmMac)
.add(Instructions.modTunnelId(Long.parseLong(dstVni
.segmentationId())));
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment.build())
.withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(L3FWD_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());
}
}
示例11: programSnatSameSegmentRules
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的package包/类
@Override
public void programSnatSameSegmentRules(DeviceId deviceId, SegmentationId matchVni,
IpAddress srcIP, IpAddress dstIP, 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))
.matchIPDst(IpPrefix.valueOf(dstIP, 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_SAME_SEG_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
flowObjectiveService.forward(deviceId, objective.add());
} else {
flowObjectiveService.forward(deviceId, objective.remove());
}
}
示例12: programSnatDiffSegmentRules
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的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());
}
}
示例13: programSnatSameSegmentUploadControllerRules
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的package包/类
@Override
public void programSnatSameSegmentUploadControllerRules(DeviceId deviceId,
SegmentationId matchVni,
IpAddress srcIP,
IpAddress dstIP,
IpPrefix prefix,
Operation type) {
TrafficSelector selector = DefaultTrafficSelector.builder()
.matchEthType(Ethernet.TYPE_IPV4)
.matchTunnelId(Long.parseLong(matchVni.segmentationId()))
.matchIPSrc(IpPrefix.valueOf(srcIP, PREFIC_LENGTH))
.matchIPDst(IpPrefix.valueOf(dstIP, prefix.prefixLength()))
.build();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
treatment.add(Instructions.createOutput(PortNumber.CONTROLLER));
ForwardingObjective.Builder objective = DefaultForwardingObjective
.builder().withTreatment(treatment.build())
.withSelector(selector).fromApp(appId).withFlag(Flag.SPECIFIC)
.withPriority(SNAT_SAME_SEG_CON_PRIORITY);
if (type.equals(Objective.Operation.ADD)) {
flowObjectiveService.forward(deviceId, objective.add());
} else {
flowObjectiveService.forward(deviceId, objective.remove());
}
}
示例14: activate
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的package包/类
@Activate
public void activate() {
appId = coreService.registerApplication(VTNRSC_APP);
networkIdAsKeyStore = storageService.<TenantNetworkId, TenantNetwork>consistentMapBuilder()
.withName(TENANTNETWORK)
.withApplicationId(appId)
.withPurgeOnUninstall()
.withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
TenantNetworkId.class,
DefaultTenantNetwork.class,
TenantNetwork.State.class,
TenantId.class,
TenantNetwork.Type.class,
PhysicalNetwork.class,
SegmentationId.class))
.build().asJavaMap();
log.info("Started");
}
示例15: execute
import org.onosproject.vtnrsc.SegmentationId; //导入依赖的package包/类
@Override
protected void execute() {
TenantNetworkService service = get(TenantNetworkService.class);
TenantNetwork network = new DefaultTenantNetwork(TenantNetworkId.networkId(id), name,
adminStateUp,
TenantNetwork.State.valueOf(state),
shared, TenantId.tenantId(tenantID),
routerExternal,
TenantNetwork.Type.valueOf(type),
PhysicalNetwork.physicalNetwork(physicalNetwork),
SegmentationId.segmentationId(segmentationID));
Set<TenantNetwork> networksSet = Sets.newHashSet();
networksSet.add(network);
service.updateNetworks(networksSet);
}