reference "http://tools.ietf.org/html/rfc4873#section-4.1";
uses rsvp-te-object;
- uses explicit-route-subobjects-list {
- augment "subobject-container/subobject-type" {
- case basic-protection-case {
- container basic-protection {
- uses protection-subobject;
- }
+ list subobject-container {
+ leaf loose {
+ type boolean;
+ mandatory true;
+ }
+
+ uses secondary-explicit-route-subobjects;
+ ordered-by user;
+ }
+ }
+ }
+
+ grouping secondary-explicit-route-subobjects {
+ uses explicit-route-subobjects {
+ augment "subobject-type" {
+ case basic-protection-case {
+ container basic-protection {
+ uses protection-subobject;
}
+ }
- case dynamic-control-protection-case {
- container dynamic-control-protection {
- uses protection-subobject;
- }
+ case dynamic-control-protection-case {
+ container dynamic-control-protection {
+ uses protection-subobject;
}
}
}
grouping secondary-record-route-object {
container secondary-record-route-object {
uses rsvp-te-object;
- uses record-route-subobjects-list {
- augment "subobject-container/subobject-type" {
- case basic-protection-case {
- container basic-protection {
- uses protection-subobject;
- }
+ list subobject-container {
+ uses secondary-record-route-subobjects;
+ ordered-by user;
+ }
+ }
+ }
+
+ grouping secondary-record-route-subobjects {
+ uses record-route-subobjects {
+ augment "subobject-type" {
+ case basic-protection-case {
+ container basic-protection {
+ uses protection-subobject;
}
+ }
- case dynamic-control-protection-case {
- container dynamic-control-protection {
- uses protection-subobject;
- }
+ case dynamic-control-protection-case {
+ container dynamic-control-protection {
+ uses protection-subobject;
}
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.object.protection.object.dynamic.control.protection.object._case.DynamicControlProtectionObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.object.RecordRouteObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.SecondaryExplicitRouteObject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.BasicProtectionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.DynamicControlProtectionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.BasicProtectionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.DynamicControlProtectionCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.SecondaryRecordRouteObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.session.attribute.object.session.attribute.object.BasicSessionAttributeObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.session.attribute.object.session.attribute.object.SessionAttributeObjectWithResourcesAffinities;
final SRROBasicProtectionSubobjectParser srroBasicParser = new SRROBasicProtectionSubobjectParser();
final SRRODynamicProtectionSubobjectParser srroDynamicParser = new SRRODynamicProtectionSubobjectParser();
regs.add(context.registerRROSubobjectParser(SRROBasicProtectionSubobjectParser.TYPE, srroBasicParser));
- regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
- .yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container
- .subobject.type.BasicProtectionCase.class, srroBasicParser));
- regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
- .yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container
- .subobject.type.DynamicControlProtectionCase.class, srroDynamicParser));
+ regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .rsvp.rev150820.secondary.record.route.subobjects.subobject.type
+ .BasicProtectionCase.class, srroBasicParser));
+ regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+ .rsvp.rev150820.secondary.record.route.subobjects.subobject.type
+ .DynamicControlProtectionCase.class, srroDynamicParser));
}
private static void registerXROParsers(final List<AutoCloseable> regs, final RSVPExtensionProviderContext context) {
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainerBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.BasicProtectionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.BasicProtectionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.DynamicControlProtectionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.basic.protection._case.BasicProtectionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.dynamic.control.protection._case.DynamicControlProtectionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.BasicProtectionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.BasicProtectionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.DynamicControlProtectionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.basic.protection._case.BasicProtectionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.dynamic.control.protection._case.DynamicControlProtectionBuilder;
public class SEROBasicProtectionSubobjectParser extends ProtectionCommonParser implements EROSubobjectParser,
EROSubobjectSerializer {
import org.opendaylight.protocol.rsvp.parser.spi.EROSubobjectUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.DynamicControlProtectionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.DynamicControlProtectionCase;
/**
* Parser for {@link DynamicControlProtectionCase}.
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container.subobject.type.BasicProtectionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container.subobject.type.BasicProtectionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container.subobject.type.DynamicControlProtectionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container.subobject.type.basic.protection._case.BasicProtectionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container.subobject.type.dynamic.control.protection._case.DynamicControlProtectionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.subobjects.subobject.type.BasicProtectionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.subobjects.subobject.type.BasicProtectionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.subobjects.subobject.type.DynamicControlProtectionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.subobjects.subobject.type.basic.protection._case.BasicProtectionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.subobjects.subobject.type.dynamic.control.protection._case.DynamicControlProtectionBuilder;
/**
* Parser for {@link BasicProtectionCase}.
import org.opendaylight.protocol.rsvp.parser.spi.RROSubobjectSerializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container.subobject.type.DynamicControlProtectionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.subobjects.subobject.type.DynamicControlProtectionCase;
public class SRRODynamicProtectionSubobjectParser extends ProtectionCommonParser implements RROSubobjectSerializer {
public static final int TYPE = 37;
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import java.util.List;
+import java.util.stream.Collectors;
import org.opendaylight.protocol.rsvp.parser.spi.RROSubobjectRegistry;
import org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException;
import org.opendaylight.protocol.rsvp.parser.spi.subobjects.RROSubobjectListParser;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.SecondaryRecordRouteObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.SecondaryRecordRouteObjectBuilder;
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final SecondaryRecordRouteObjectBuilder srro = new SecondaryRecordRouteObjectBuilder();
- return srro.setSubobjectContainer(parseList(byteBuf)).build();
+
+ final List<SubobjectContainer> sbo = parseList(byteBuf);
+ final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record
+ .route.object.secondary.record.route.object.SubobjectContainer> srroSbo = sbo.stream()
+ .map(so -> new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary
+ .record.route.object.secondary.record.route.object.SubobjectContainerBuilder()
+ .setProtectionAvailable(so.isProtectionAvailable())
+ .setProtectionInUse(so.isProtectionInUse())
+ .setSubobjectType(so.getSubobjectType())
+ .build()
+ ).collect(Collectors.toList());
+ return srro.setSubobjectContainer(srroSbo).build();
}
@Override
"RecordRouteObject is mandatory.");
final SecondaryRecordRouteObject srro = (SecondaryRecordRouteObject) teLspObject;
final ByteBuf bufferAux = Unpooled.buffer();
- serializeList(srro.getSubobjectContainer(), bufferAux);
+ final List<SubobjectContainer> srroSbo = srro.getSubobjectContainer()
+ .stream().map(so -> new SubobjectContainerBuilder()
+ .setProtectionAvailable(so.isProtectionAvailable())
+ .setProtectionInUse(so.isProtectionInUse())
+ .setSubobjectType(so.getSubobjectType())
+ .build()).collect(Collectors.toList());
+ serializeList(srroSbo, bufferAux);
serializeAttributeHeader(bufferAux.readableBytes(), CLASS_NUM, CTYPE, output);
output.writeBytes(bufferAux);
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainerBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.DynamicControlProtectionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.DynamicControlProtectionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.subobjects.subobject.type.DynamicControlProtectionCase;
public class TEObjectTest {
private RSVPActivator act;
@Test(expected = IllegalArgumentException.class)
public void testWrongSerializeSRRO() throws RSVPParsingException {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route
- .object.secondary.record.route.object.subobject.container.subobject.type
- .DynamicControlProtectionCase dynamicProtection = new org.opendaylight.yang.gen.v1.urn
- .opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route
- .object.subobject.container.subobject.type.DynamicControlProtectionCaseBuilder().build();
+ final DynamicControlProtectionCase dynamicProtection = new org.opendaylight.yang.gen.v1.urn.opendaylight.params
+ .xml.ns.yang.rsvp.rev150820.secondary.record.route.subobjects.subobject.type
+ .DynamicControlProtectionCaseBuilder().build();
final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects
.list.SubobjectContainer subContainer = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
package org.opendaylight.protocol.rsvp.parser.spi;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.SubobjectContainer;
public interface SRROSubobjectParser {
SubobjectContainer parseSubobject(ByteBuf buffer) throws RSVPParsingException;
package org.opendaylight.protocol.rsvp.parser.spi;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.SubobjectContainer;
public interface SRROSubobjectSerializer {
void serializeSubobject(SubobjectContainer subobject, ByteBuf buffer);