本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId类的典型用法代码示例。如果您正苦于以下问题:Java VlanId类的具体用法?Java VlanId怎么用?Java VlanId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VlanId类属于org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827包,在下文中一共展示了VlanId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createVlanIdMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
/**
* Create Ethernet Destination Match
*
* @param matchBuilder
* MatchBuilder Object without a match yet
* @param vlanId
* Integer representing a VLAN ID Integer representing a VLAN ID
* @return matchBuilder Map MatchBuilder Object with a match
*/
public static MatchBuilder createVlanIdMatch(MatchBuilder matchBuilder, VlanId vlanId, boolean present) {
VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
if (vlanId.getValue() != 0) vlanIdBuilder.setVlanId(new VlanId(vlanId));
vlanIdBuilder.setVlanIdPresent(present);
vlanMatchBuilder.setVlanId(vlanIdBuilder.build());
//VlanPcp vp = new VlanPcp((short)3);
//vlanMatchBuilder.setVlanPcp(vp);
matchBuilder.setVlanMatch(vlanMatchBuilder.build());
return matchBuilder;
}
开发者ID:opendaylight,项目名称:faas,代码行数:25,代码来源:OfMatchUtils.java
示例2: createVlanIdMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
/**
* Create Ethernet Destination Match
*
* @param matchBuilder MatchBuilder Object without a match yet
* @param vlanId Integer representing a VLAN ID Integer representing a VLAN ID
* @return matchBuilder Map MatchBuilder Object with a match
*/
public static MatchBuilder createVlanIdMatch(MatchBuilder matchBuilder, Integer vlanId, boolean present) {
EthernetMatchBuilder eth = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(VLANTAGGED_LONG));
eth.setEthernetType(ethTypeBuilder.build());
matchBuilder.setEthernetMatch(eth.build());
VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
vlanIdBuilder.setVlanId(new VlanId(vlanId));
vlanIdBuilder.setVlanIdPresent(present);
vlanMatchBuilder.setVlanId(vlanIdBuilder.build());
matchBuilder.setVlanMatch(vlanMatchBuilder.build());
return matchBuilder;
}
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:24,代码来源:MatchUtils.java
示例3: testUpdateVlan
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testUpdateVlan() throws Exception {
Port port = mock(Port.class);
Column<GenericTableSchema, Set<Long>> column = mock(Column.class);
when(port.getTagColumn()).thenReturn(column);
Set<Long> vlanId = new HashSet<>();
vlanId.add((long) 808);
when(column.getData()).thenReturn(vlanId);
PowerMockito.whenNew(VlanId.class).withAnyArguments().thenReturn(mock(VlanId.class));
OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointBuilder = mock(
OvsdbTerminationPointAugmentationBuilder.class);
when(ovsdbTerminationPointBuilder.setVlanTag(any(VlanId.class))).thenReturn(ovsdbTerminationPointBuilder);
Whitebox.invokeMethod(ovsdbPortUpdateCommand, "updateVlan", port, ovsdbTerminationPointBuilder);
verify(ovsdbTerminationPointBuilder).setVlanTag(any(VlanId.class));
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:17,代码来源:OvsdbPortUpdateCommandTest.java
示例4: testUpdateVlanTrunks
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testUpdateVlanTrunks() throws Exception {
Port port = mock(Port.class);
Column<GenericTableSchema, Set<Long>> column = mock(Column.class);
when(port.getTrunksColumn()).thenReturn(column);
Set<Long> portTrunks = new HashSet<>();
portTrunks.add((long) 300);
when(column.getData()).thenReturn(portTrunks);
TrunksBuilder trunksBuilder = mock(TrunksBuilder.class);
PowerMockito.whenNew(TrunksBuilder.class).withNoArguments().thenReturn(trunksBuilder);
PowerMockito.whenNew(VlanId.class).withAnyArguments().thenReturn(mock(VlanId.class));
when(trunksBuilder.setTrunk(any(VlanId.class))).thenReturn(trunksBuilder);
OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointBuilder = mock(
OvsdbTerminationPointAugmentationBuilder.class);
when(ovsdbTerminationPointBuilder.setTrunks(any(List.class))).thenReturn(ovsdbTerminationPointBuilder);
Whitebox.invokeMethod(ovsdbPortUpdateCommand, "updateVlanTrunks", port, ovsdbTerminationPointBuilder);
verify(trunksBuilder).setTrunk(any(VlanId.class));
verify(ovsdbTerminationPointBuilder).setTrunks(any(List.class));
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:22,代码来源:OvsdbPortUpdateCommandTest.java
示例5: getIngressInterfaceFlow
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
private Optional<PolicyAceFlowWrapper> getIngressInterfaceFlow(IngressInterface ingressInterface) {
String interfaceName = ingressInterface.getName();
if (interfaceName == null) {
LOG.error("Invalid ingress interface augmentation. missing interface name");
return Optional.absent();
}
String flowName = "INGRESS_INTERFACE_" + interfaceName;
int flowPriority = PolicyServiceConstants.POLICY_ACL_TRUNK_INTERFACE_FLOW_PRIOPITY;
VlanId vlanId = ingressInterface.getVlanId();
if (vlanId != null) {
Optional<String> vlanMemberInterfaceOpt = policyServiceUtil.getVlanMemberInterface(interfaceName, vlanId);
if (!vlanMemberInterfaceOpt.isPresent()) {
LOG.debug("Vlan member {} missing for trunk {}", vlanId.getValue(), interfaceName);
return Optional.of(new PolicyAceFlowWrapper(flowName, PolicyAceFlowWrapper.PARTIAL));
}
interfaceName = vlanMemberInterfaceOpt.get();
flowPriority = PolicyServiceConstants.POLICY_ACL_VLAN_INTERFACE_FLOW_PRIOPITY;
}
List<MatchInfoBase> matches = policyFlowUtil.getIngressInterfaceMatches(interfaceName);
if (matches == null || matches.isEmpty()) {
LOG.debug("Failed to get ingress interface {} matches", interfaceName);
return Optional.of(new PolicyAceFlowWrapper(flowName, PolicyAceFlowWrapper.PARTIAL));
}
BigInteger dpId = interfaceManager.getDpnForInterface(interfaceName);
if (dpId == null) {
dpId = BigInteger.ZERO;
}
return Optional.of(new PolicyAceFlowWrapper(flowName, matches, flowPriority, dpId));
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:34,代码来源:PolicyAceFlowProgrammer.java
示例6: getVlanMemberInterface
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
public Optional<String> getVlanMemberInterface(String trunkInterface, VlanId vlanId) {
List<Interface> vlanMemberInterfaces = interfaceManager.getChildInterfaces(trunkInterface);
if (vlanMemberInterfaces == null || vlanMemberInterfaces.isEmpty()) {
LOG.debug("No child interfaces found for trunk {}", trunkInterface);
return Optional.absent();
}
return vlanMemberInterfaces.stream()
.filter(iface -> isVlanMemberInterface(iface, vlanId))
.findFirst()
.map(Interface::getName)
.map(Optional::of)
.orElseGet(Optional::absent);
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:15,代码来源:PolicyServiceUtil.java
示例7: isVlanMemberInterface
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
private boolean isVlanMemberInterface(Interface iface, VlanId vlanId) {
IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
if (l2vlan == null || !L2vlanMode.TrunkMember.equals(l2vlan.getL2vlanMode())) {
LOG.warn("Interface {} is not VLAN member", iface.getName());
return false;
}
return Objects.equals(vlanId, l2vlan.getVlanId());
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:10,代码来源:PolicyServiceUtil.java
示例8: createVlanBinding
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
public static VlanBindings createVlanBinding(Long key, String logicalSwitch) {
VlanBindingsBuilder vbBuilder = new VlanBindingsBuilder();
VlanBindingsKey vbKey = new VlanBindingsKey(new VlanId(key.intValue()));
vbBuilder.setKey(vbKey);
vbBuilder.setVlanIdKey(vbKey.getVlanIdKey());
HwvtepLogicalSwitchRef hwvtepLogicalSwitchRef =
new HwvtepLogicalSwitchRef(createInstanceIdentifier(logicalSwitch));
vbBuilder.setLogicalSwitchRef(hwvtepLogicalSwitchRef);
return vbBuilder.build();
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:11,代码来源:PhysicalSwitchHelper.java
示例9: setVlanVidAction
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
public static Action setVlanVidAction(Integer vlanId) {
VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
vlanIdBuilder.setVlanId(new VlanId(vlanId));
vlanIdBuilder.setVlanIdPresent(true);
vlanMatchBuilder.setVlanId(vlanIdBuilder.build());
SetFieldBuilder setFieldBuilder = new SetFieldBuilder()
.setVlanMatch((vlanMatchBuilder.build()));
return new SetFieldCaseBuilder()
.setSetField(setFieldBuilder.build())
.build();
}
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:14,代码来源:ActionUtils.java
示例10: updateVlan
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
private void updateVlan(final Port port,
final OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointBuilder) {
Collection<Long> vlanId = port.getTagColumn().getData();
if (vlanId.size() > 0) {
Iterator<Long> itr = vlanId.iterator();
// There are no loops here, just get the first element.
int id = itr.next().intValue();
ovsdbTerminationPointBuilder.setVlanTag(new VlanId(id));
}
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:12,代码来源:OvsdbPortUpdateCommand.java
示例11: updateVlanTrunks
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
private void updateVlanTrunks(final Port port,
final OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointBuilder) {
Set<Long> portTrunks = port.getTrunksColumn().getData();
List<Trunks> modelTrunks = new ArrayList<>();
if (!portTrunks.isEmpty()) {
for (Long trunk: portTrunks) {
if (trunk != null) {
modelTrunks.add(new TrunksBuilder()
.setTrunk(new VlanId(trunk.intValue())).build());
}
}
}
ovsdbTerminationPointBuilder.setTrunks(modelTrunks);
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:16,代码来源:OvsdbPortUpdateCommand.java
示例12: buildTrunkList
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
private List<Trunks> buildTrunkList(Set<Integer> trunkSet) {
List<Trunks> trunkList = new ArrayList<>();
for (Integer trunk : trunkSet) {
TrunksBuilder trunkBuilder = new TrunksBuilder();
trunkBuilder.setTrunk(new VlanId(trunk));
trunkList.add(trunkBuilder.build());
}
return trunkList;
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:10,代码来源:SouthboundIT.java
示例13: createVlanBinding
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
private VlanBindings createVlanBinding(Long key, UUID value) {
VlanBindingsBuilder vbBuilder = new VlanBindingsBuilder();
VlanBindingsKey vbKey = new VlanBindingsKey(new VlanId(key.intValue()));
vbBuilder.setKey(vbKey);
vbBuilder.setVlanIdKey(vbKey.getVlanIdKey());
HwvtepLogicalSwitchRef lSwitchRef = this.getLogicalSwitchRef(value);
vbBuilder.setLogicalSwitchRef(lSwitchRef);
return vbBuilder.build();
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:10,代码来源:HwvtepPhysicalPortUpdateCommand.java
示例14: createSubPortInterface
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
private void createSubPortInterface(Trunk trunk, SubPorts subPort) {
if (!NetworkTypeVlan.class.equals(subPort.getSegmentationType())) {
LOG.warn("SegmentationType other than VLAN not supported for Trunk:SubPorts");
return;
}
String portName = subPort.getPortId().getValue();
String parentName = trunk.getPortId().getValue();
InstanceIdentifier<Interface> interfaceIdentifier = NeutronvpnUtils.buildVlanInterfaceIdentifier(portName);
// Should we use parentName?
jobCoordinator.enqueueJob("PORT- " + portName, () -> {
Interface iface = ifMgr.getInterfaceInfoFromConfigDataStore(portName);
List<ListenableFuture<Void>> futures = new ArrayList<>();
if (iface == null) {
/*
* Trunk creation requires NeutronPort to be present, by this time interface
* should've been created. In controller restart use case Interface would already be present.
* Clustering consideration:
* This being same shard as NeutronPort, interface creation will be triggered on the same
* node as this one. Use of DSJC helps ensure the order.
*/
LOG.warn("Interface not present for Trunk SubPort: {}", subPort);
return futures;
}
InterfaceBuilder interfaceBuilder = new InterfaceBuilder();
IfL2vlan ifL2vlan = new IfL2vlanBuilder().setL2vlanMode(IfL2vlan.L2vlanMode.TrunkMember)
.setVlanId(new VlanId(subPort.getSegmentationId().intValue())).build();
ParentRefs parentRefs = new ParentRefsBuilder().setParentInterface(parentName).build();
SplitHorizon splitHorizon = new SplitHorizonBuilder().setOverrideSplitHorizonProtection(true).build();
interfaceBuilder.setName(portName).setType(L2vlan.class).addAugmentation(IfL2vlan.class, ifL2vlan)
.addAugmentation(ParentRefs.class, parentRefs).addAugmentation(SplitHorizon.class, splitHorizon);
iface = interfaceBuilder.build();
/*
* Interface is already created for parent NeutronPort. We're updating parent refs
* and VLAN Information
*/
WriteTransaction txn = dataBroker.newWriteOnlyTransaction();
txn.merge(LogicalDatastoreType.CONFIGURATION, interfaceIdentifier, iface);
LOG.trace("Creating trunk member interface {}", iface);
futures.add(txn.submit());
return futures;
});
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:44,代码来源:NeutronTrunkChangeListener.java
示例15: programVlanInPort
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; //导入依赖的package包/类
public void programVlanInPort(Long dpid, Long vlanId, Long segmentationId, Long inPort, boolean isWriteFlow) {
String nodeName = OPENFLOW + dpid;
MatchBuilder matchBuilder = new MatchBuilder();
NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
FlowBuilder flowBuilder = new FlowBuilder();
// Create the OF Match using MatchBuilder
flowBuilder.setMatch(OfMatchUtils.createInPortMatch(matchBuilder, dpid, inPort).build());
flowBuilder.setMatch(OfMatchUtils.createVlanIdMatch(matchBuilder, new VlanId(vlanId.intValue()), true).build());
String flowId = "VlanIn_" + vlanId + "_" + inPort + "_" + segmentationId;
// Add Flow Attributes
flowBuilder.setId(new FlowId(flowId));
FlowKey key = new FlowKey(new FlowId(flowId));
flowBuilder.setStrict(true);
flowBuilder.setBarrier(false);
flowBuilder.setTableId(getTable());
flowBuilder.setKey(key);
flowBuilder.setPriority(16384);
flowBuilder.setFlowName(flowId);
flowBuilder.setHardTimeout(0);
flowBuilder.setIdleTimeout(0);
if (isWriteFlow) {
// Instantiate the Builders for the OF Actions and Instructions
InstructionBuilder ib = new InstructionBuilder();
InstructionsBuilder isb = new InstructionsBuilder();
// Instructions List Stores Individual Instructions
List<Instruction> instructions = Lists.newArrayList();
OfInstructionUtils.createSetTunnelIdInstructions(ib, BigInteger.valueOf(segmentationId.longValue()));
ApplyActionsCase aac = (ApplyActionsCase) ib.getInstruction();
List<Action> actionList = aac.getApplyActions().getAction();
ActionBuilder ab = new ActionBuilder();
ab.setAction(OfActionUtils.nxLoadRegAction(new DstNxRegCaseBuilder().setNxReg(REG_FIELD).build(),
BigInteger.valueOf(REG_VALUE_FROM_VLAN)));
ab.setOrder(actionList.size());
ab.setKey(new ActionKey(actionList.size()));
actionList.add(ab.build());
ab.setAction(OfActionUtils.nxLoadRegAction(new DstNxRegCaseBuilder().setNxReg(REG_SRC_TUN_ID).build(),
BigInteger.valueOf(REG2_DEFAULT_PERMIT_VNI)));
ab.setOrder(actionList.size());
ab.setKey(new ActionKey(actionList.size()));
actionList.add(ab.build());
ib.setOrder(instructions.size());
ib.setKey(new InstructionKey(instructions.size()));
instructions.add(ib.build());
// Next service GOTO Instructions Need to be appended to the List
ib = this.getMutablePipelineInstructionBuilder();
ib.setOrder(instructions.size());
ib.setKey(new InstructionKey(instructions.size()));
instructions.add(ib.build());
// Add InstructionBuilder to the Instruction(s)Builder List
isb.setInstruction(instructions);
// Add InstructionsBuilder to FlowBuilder
flowBuilder.setInstructions(isb.build());
writeFlow(flowBuilder, nodeBuilder);
} else {
removeFlow(flowBuilder, nodeBuilder);
}
}
开发者ID:opendaylight,项目名称:faas,代码行数:73,代码来源:PipelineTrafficClassifier.java
注:本文中的org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论