use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.MetricsBuilder in project bgpcep by opendaylight.
the class PCEPRequestMessageParser method insertObject.
private static State insertObject(final State state, final List<Object> objects, final List<VendorInformationObject> viObjects, final P2pBuilder builder, final List<Metrics> metrics, final List<Message> errors, final Rp rp) {
final Object obj = objects.get(0);
switch(state) {
case INIT:
if (obj instanceof Rro) {
builder.setRro((Rro) obj);
objects.remove(0);
final Object nextObj = objects.get(0);
if (nextObj instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reoptimization.bandwidth.object.ReoptimizationBandwidth) {
builder.setReoptimizationBandwidth((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reoptimization.bandwidth.object.ReoptimizationBandwidth) nextObj);
}
return State.REPORTED_IN;
}
case REPORTED_IN:
if (obj instanceof VendorInformationObject) {
viObjects.add((VendorInformationObject) obj);
return State.REPORTED_IN;
}
case VENDOR_INFO_LIST:
if (obj instanceof LoadBalancing) {
builder.setLoadBalancing((LoadBalancing) obj);
return State.LOAD_BIN;
}
case LOAD_BIN:
if (obj instanceof Lspa) {
builder.setLspa((Lspa) obj);
return State.LSPA_IN;
}
case LSPA_IN:
if (obj instanceof Bandwidth) {
builder.setBandwidth((Bandwidth) obj);
return State.BANDWIDTH_IN;
}
case BANDWIDTH_IN:
if (obj instanceof Metric) {
metrics.add(new MetricsBuilder().setMetric((Metric) obj).build());
return State.BANDWIDTH_IN;
}
case METRIC_IN:
if (obj instanceof Iro) {
builder.setIro((Iro) obj);
return State.IRO_IN;
}
case IRO_IN:
if (obj instanceof Rro) {
builder.setRro((Rro) obj);
return State.RRO_IN;
}
case RRO_IN:
if (obj instanceof Xro) {
builder.setXro((Xro) obj);
return State.XRO_IN;
}
case XRO_IN:
if (obj instanceof Of) {
builder.setOf((Of) obj);
return State.OF_IN;
}
case OF_IN:
if (obj instanceof ClassType) {
final ClassType classType = (ClassType) obj;
if (!classType.isProcessingRule()) {
errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.of(rp)));
} else {
builder.setClassType(classType);
}
return State.CT_IN;
}
case CT_IN:
case END:
return State.END;
default:
return state;
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.MetricsBuilder in project bgpcep by opendaylight.
the class PCEPValidatorTest method setUp.
@Before
public void setUp() throws Exception {
this.ctx = new SimplePCEPExtensionProviderContext();
this.act = new BaseParserExtensionActivator();
this.viObjAct = new TestVendorInformationActivator();
this.act.start(this.ctx);
this.viObjAct.start(this.ctx);
this.objectRegistry = this.ctx.getObjectHandlerRegistry();
final RpBuilder rpBuilder = new RpBuilder();
rpBuilder.setProcessingRule(true);
rpBuilder.setIgnore(false);
rpBuilder.setReoptimization(false);
rpBuilder.setBiDirectional(false);
rpBuilder.setLoose(true);
rpBuilder.setMakeBeforeBreak(false);
rpBuilder.setOrder(false);
rpBuilder.setPathKey(false);
rpBuilder.setSupplyOf(false);
rpBuilder.setFragmentation(false);
rpBuilder.setP2mp(false);
rpBuilder.setEroCompression(false);
rpBuilder.setPriority((short) 1);
rpBuilder.setRequestId(new RequestId(10L));
rpBuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.rp.TlvsBuilder().build());
this.rpTrue = rpBuilder.build();
rpBuilder.setProcessingRule(false);
this.rpFalse = rpBuilder.build();
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder openBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder();
openBuilder.setProcessingRule(false);
openBuilder.setIgnore(false);
openBuilder.setDeadTimer((short) 1);
openBuilder.setKeepalive((short) 1);
openBuilder.setSessionId((short) 0);
openBuilder.setVersion(new ProtocolVersion((short) 1));
openBuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.TlvsBuilder().build());
this.open = openBuilder.build();
final NoPathBuilder npbuilder = new NoPathBuilder();
npbuilder.setProcessingRule(false);
npbuilder.setIgnore(false);
npbuilder.setNatureOfIssue((short) 0);
npbuilder.setUnsatisfiedConstraints(false);
npbuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure._case.no.path.TlvsBuilder().build());
this.noPath = npbuilder.build();
final LspaBuilder lspaBuilder = new LspaBuilder();
lspaBuilder.setProcessingRule(false);
lspaBuilder.setIgnore(false);
lspaBuilder.setLocalProtectionDesired(false);
lspaBuilder.setHoldPriority((short) 0);
lspaBuilder.setSetupPriority((short) 0);
lspaBuilder.setExcludeAny(new AttributeFilter(0L));
lspaBuilder.setIncludeAll(new AttributeFilter(0L));
lspaBuilder.setIncludeAny(new AttributeFilter(0L));
lspaBuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.lspa.TlvsBuilder().build());
this.lspa = lspaBuilder.build();
final MetricBuilder mBuilder = new MetricBuilder();
mBuilder.setIgnore(false);
mBuilder.setProcessingRule(false);
mBuilder.setComputed(false);
mBuilder.setBound(false);
mBuilder.setMetricType((short) 1);
mBuilder.setValue(new Float32(new byte[4]));
this.metrics = new MetricsBuilder().setMetric(mBuilder.build()).build();
this.eroASSubobject = new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber(0xFFFFL)).build()).build();
final IroBuilder iroBuilder = new IroBuilder();
iroBuilder.setIgnore(false);
iroBuilder.setProcessingRule(false);
final List<Subobject> iroSubs = Lists.newArrayList();
iroSubs.add(new SubobjectBuilder().setSubobjectType(this.eroASSubobject).setLoose(false).build());
iroBuilder.setSubobject(iroSubs);
this.iro = iroBuilder.build();
final EroBuilder eroBuilder = new EroBuilder();
eroBuilder.setIgnore(false);
eroBuilder.setProcessingRule(false);
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject> eroSubs = Lists.newArrayList();
eroSubs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.SubobjectBuilder().setSubobjectType(this.eroASSubobject).setLoose(false).build());
eroBuilder.setSubobject(eroSubs);
this.ero = eroBuilder.build();
final OfBuilder ofBuilder = new OfBuilder();
ofBuilder.setIgnore(false);
ofBuilder.setProcessingRule(false);
ofBuilder.setCode(new OfId(0));
ofBuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.of.TlvsBuilder().build());
this.of = ofBuilder.build();
final Ipv4Builder afi = new Ipv4Builder();
afi.setSourceIpv4Address(new Ipv4Address("255.255.255.255"));
afi.setDestinationIpv4Address(new Ipv4Address("255.255.255.255"));
final EndpointsObjBuilder epBuilder = new EndpointsObjBuilder();
epBuilder.setIgnore(false);
epBuilder.setProcessingRule(true);
epBuilder.setAddressFamily(new Ipv4CaseBuilder().setIpv4(afi.build()).build());
this.endpoints = epBuilder.build();
final SvecBuilder sBuilder = new SvecBuilder();
sBuilder.setIgnore(false);
sBuilder.setProcessingRule(false);
sBuilder.setLinkDiverse(false);
sBuilder.setNodeDiverse(false);
sBuilder.setSrlgDiverse(false);
sBuilder.setRequestsIds(Lists.newArrayList(new RequestId(1L)));
this.svec = sBuilder.build();
this.viObjects = Lists.newArrayList();
final TestEnterpriseSpecificInformation esInfo = new TestEnterpriseSpecificInformation(5);
final VendorInformationObject viObj = new VendorInformationObjectBuilder().setEnterpriseNumber(new EnterpriseNumber(0L)).setEnterpriseSpecificInformation(esInfo).build();
this.viObjects.add(viObj);
this.monitoring = new MonitoringBuilder().setMonitoringId(100L).setFlags(new Flags(false, false, false, false, false)).setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.monitoring.TlvsBuilder().build()).build();
this.pccIdReq = new PccIdReqBuilder().setIpAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).build();
this.pceId = new PceIdBuilder().setIpAddress(new IpAddress(new Ipv4Address("127.0.0.2"))).build();
final ProcTimeBuilder procTimeBuilder = new ProcTimeBuilder();
procTimeBuilder.setEstimated(false);
procTimeBuilder.setCurrentProcTime(1L);
procTimeBuilder.setMinProcTime(2L);
procTimeBuilder.setMaxProcTime(3L);
procTimeBuilder.setAverageProcTime(4L);
procTimeBuilder.setVarianceProcTime(5L);
this.procTime = procTimeBuilder.build();
this.overload = new OverloadBuilder().setDuration(120).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.MetricsBuilder in project bgpcep by opendaylight.
the class PCEPValidatorTest method setUp.
@Before
public void setUp() throws Exception {
this.ctx = new SimplePCEPExtensionProviderContext();
this.act = new BaseParserExtensionActivator();
this.act.start(this.ctx);
final LspaBuilder lspaBuilder = new LspaBuilder();
lspaBuilder.setProcessingRule(false);
lspaBuilder.setIgnore(false);
lspaBuilder.setLocalProtectionDesired(false);
lspaBuilder.setHoldPriority((short) 0);
lspaBuilder.setSetupPriority((short) 0);
lspaBuilder.setExcludeAny(new AttributeFilter(0L));
lspaBuilder.setIncludeAll(new AttributeFilter(0L));
lspaBuilder.setIncludeAny(new AttributeFilter(0L));
lspaBuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.lspa.TlvsBuilder().build());
this.lspa = lspaBuilder.build();
final MetricBuilder mBuilder = new MetricBuilder();
mBuilder.setIgnore(false);
mBuilder.setProcessingRule(false);
mBuilder.setComputed(false);
mBuilder.setBound(false);
mBuilder.setMetricType((short) 1);
mBuilder.setValue(new Float32(new byte[4]));
this.metrics = new MetricsBuilder().setMetric(mBuilder.build()).build();
this.eroASSubobject = new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber(0xFFFFL)).build()).build();
this.rroUnnumberedSub = new UnnumberedCaseBuilder().setUnnumbered(new UnnumberedBuilder().setRouterId(0x00112233L).setInterfaceId(0x00ff00ffL).build()).build();
final IroBuilder iroBuilder = new IroBuilder();
iroBuilder.setIgnore(false);
iroBuilder.setProcessingRule(false);
final List<Subobject> iroSubs = Lists.newArrayList();
iroSubs.add(new SubobjectBuilder().setSubobjectType(this.eroASSubobject).setLoose(false).build());
iroBuilder.setSubobject(iroSubs);
this.iro = iroBuilder.build();
final EroBuilder eroBuilder = new EroBuilder();
eroBuilder.setIgnore(false);
eroBuilder.setProcessingRule(false);
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject> eroSubs = Lists.newArrayList();
eroSubs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.SubobjectBuilder().setSubobjectType(this.eroASSubobject).setLoose(false).build());
eroBuilder.setSubobject(eroSubs);
this.ero = eroBuilder.build();
final RroBuilder rroBuilder = new RroBuilder();
rroBuilder.setIgnore(false);
rroBuilder.setProcessingRule(false);
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.Subobject> rroSubs = Lists.newArrayList();
rroSubs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.SubobjectBuilder().setSubobjectType(this.rroUnnumberedSub).setProtectionAvailable(false).setProtectionInUse(false).build());
rroBuilder.setSubobject(rroSubs);
this.rro = rroBuilder.build();
final SrpBuilder srpBuilder = new SrpBuilder();
srpBuilder.setIgnore(false);
srpBuilder.setProcessingRule(false);
srpBuilder.setOperationId(new SrpIdNumber(1L));
srpBuilder.addAugmentation(Srp1.class, new Srp1Builder().setRemove(false).build());
srpBuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.srp.TlvsBuilder().build());
this.srp = srpBuilder.build();
final LspBuilder lspBuilder = new LspBuilder();
lspBuilder.setIgnore(false);
lspBuilder.setProcessingRule(false);
lspBuilder.setAdministrative(false);
lspBuilder.setDelegate(false);
lspBuilder.setPlspId(new PlspId(0L));
lspBuilder.setOperational(OperationalStatus.Down);
lspBuilder.setSync(false);
lspBuilder.setRemove(false);
lspBuilder.setTlvs(new TlvsBuilder().build());
lspBuilder.addAugmentation(Lsp1.class, new Lsp1Builder().setCreate(false).build());
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4Builder builder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4Builder();
builder.setIpv4TunnelSenderAddress(new Ipv4Address("127.0.1.1"));
final LspId lspId = new LspId(1L);
final TunnelId tunnelId = new TunnelId(1);
builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4Address("127.0.1.2")));
builder.setIpv4TunnelEndpointAddress(new Ipv4Address("127.0.1.3"));
final AddressFamily afiLsp = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
final LspIdentifiers identifier = new LspIdentifiersBuilder().setAddressFamily(afiLsp).setLspId(lspId).setTunnelId(tunnelId).build();
this.lspSrp = lspBuilder.build();
this.lsp = lspBuilder.setTlvs(new TlvsBuilder().setLspIdentifiers(identifier).build()).build();
final Ipv4Builder afi = new Ipv4Builder();
afi.setSourceIpv4Address(new Ipv4Address("255.255.255.255"));
afi.setDestinationIpv4Address(new Ipv4Address("255.255.255.255"));
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.BandwidthBuilder bandwidthBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.BandwidthBuilder();
bandwidthBuilder.setIgnore(false);
bandwidthBuilder.setProcessingRule(false);
bandwidthBuilder.setBandwidth(new Bandwidth(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }));
this.bandwidth = bandwidthBuilder.build();
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reoptimization.bandwidth.object.ReoptimizationBandwidthBuilder reoptimizationBandwidthBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reoptimization.bandwidth.object.ReoptimizationBandwidthBuilder();
reoptimizationBandwidthBuilder.setIgnore(false);
reoptimizationBandwidthBuilder.setProcessingRule(false);
reoptimizationBandwidthBuilder.setBandwidth(new Bandwidth(new byte[] { (byte) 0x47, (byte) 0x74, (byte) 0x24, (byte) 0x00 }));
this.reoptimizationBandwidth = reoptimizationBandwidthBuilder.build();
}
Aggregations