@Test public void testCreateCapabilities() throws Exception { CapabilitiesAttributeBuilder _attributeBuilder = new CapabilitiesAttributeBuilder(); CapabilitiesAttributesBuilder _attributesBuilder = new CapabilitiesAttributesBuilder(); ArrayList<Capabilities> capabilities = new ArrayList<>(); CapabilitiesBuilder capability = new CapabilitiesBuilder(); capability.setCode(CapabilityType.Ipv4Unicast); capabilities.add(capability.build()); _attributesBuilder.setCapabilities(capabilities); _attributeBuilder.setCapabilitiesAttributes(_attributesBuilder.build()); AttributeOptionalFields fields = _attributeBuilder.build(); assertEquals(fields, AttributeFactory.createCapabilities(Version.Version1).getAttributeOptionalFields()); capability = new CapabilitiesBuilder(); capability.setCode(CapabilityType.Ipv6Unicast); capabilities.add(0, capability.build()); _attributesBuilder.setCapabilities(capabilities); _attributeBuilder.setCapabilitiesAttributes(_attributesBuilder.build()); fields = _attributeBuilder.build(); assertEquals(fields, AttributeFactory.createCapabilities(Version.Version2).getAttributeOptionalFields()); capability = new CapabilitiesBuilder(); capability.setCode(CapabilityType.SubnetBindings); capabilities.add(0, capability.build()); _attributesBuilder.setCapabilities(capabilities); _attributeBuilder.setCapabilitiesAttributes(_attributesBuilder.build()); fields = _attributeBuilder.build(); assertEquals(fields, AttributeFactory.createCapabilities(Version.Version3).getAttributeOptionalFields()); fields = _attributeBuilder.build(); assertEquals(fields, AttributeFactory.createCapabilities(Version.Version4).getAttributeOptionalFields()); }
public static Attribute createCapabilities(Version version) throws UnknownVersionException, CapabilityLengthException { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(NONTRANSITIVE_COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.Capabilities); List<Capabilities> capabilities = getCapabilities(version); byte[] value = encodeCapabilities(capabilities); attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); CapabilitiesAttributeBuilder _attributeBuilder = new CapabilitiesAttributeBuilder(); CapabilitiesAttributesBuilder _attributesBuilder = new CapabilitiesAttributesBuilder(); _attributesBuilder.setCapabilities(capabilities); _attributeBuilder.setCapabilitiesAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); }
AttributeFactory { public static Attribute createCapabilities(Version version) throws UnknownVersionException, CapabilityLengthException { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(NONTRANSITIVE_COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.Capabilities); List<Capabilities> capabilities = getCapabilities(version); byte[] value = encodeCapabilities(capabilities); attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); CapabilitiesAttributeBuilder _attributeBuilder = new CapabilitiesAttributeBuilder(); CapabilitiesAttributesBuilder _attributesBuilder = new CapabilitiesAttributesBuilder(); _attributesBuilder.setCapabilities(capabilities); _attributeBuilder.setCapabilitiesAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); } }
AttributeFactory { public static Attribute createCapabilities(Version version) throws UnknownVersionException, CapabilityLengthException { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(NONTRANSITIVE_COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.Capabilities); List<Capabilities> capabilities = getCapabilities(version); byte[] value = encodeCapabilities(capabilities); attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); CapabilitiesAttributeBuilder _attributeBuilder = new CapabilitiesAttributeBuilder(); CapabilitiesAttributesBuilder _attributesBuilder = new CapabilitiesAttributesBuilder(); _attributesBuilder.setCapabilities(capabilities); _attributeBuilder.setCapabilitiesAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); }  }
AttributeFactory { public static Attribute createCapabilities(Version version) throws UnknownVersionException, CapabilityLengthException { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(NONTRANSITIVE_COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.Capabilities); List<Capabilities> capabilities = getCapabilities(version); byte[] value = encodeCapabilities(capabilities); attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); CapabilitiesAttributeBuilder _attributeBuilder = new CapabilitiesAttributeBuilder(); CapabilitiesAttributesBuilder _attributesBuilder = new CapabilitiesAttributesBuilder(); _attributesBuilder.setCapabilities(capabilities); _attributeBuilder.setCapabilitiesAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); }  static Attribute createCapabilities(Version version); static Attribute createHoldTime(int holdTimeMin); static Attribute createHoldTime(int holdTimeMin, int holdTimeMax); static Attribute createIpv4AddPrefix(List<IpPrefix> prefixes, byte flags); static Attribute createIpv4DeletePrefix(List<IpPrefix> prefixes, byte flags); static Attribute createIpv6AddPrefix(List<IpPrefix> prefixes, byte flags); static Attribute createIpv6DeletePrefix(List<IpPrefix> prefixes, byte flags); static Attribute createPeerSequence(List<NodeId> nodesIds); static Attribute createSourceGroupTag(int sgt); static Attribute createSxpNodeId(NodeId nodeId); static byte[] encodeCapability(Capabilities capability); }
AttributeFactory { public static Attribute createCapabilities(Version version) throws UnknownVersionException, CapabilityLengthException { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(NONTRANSITIVE_COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.Capabilities); List<Capabilities> capabilities = getCapabilities(version); byte[] value = encodeCapabilities(capabilities); attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); CapabilitiesAttributeBuilder _attributeBuilder = new CapabilitiesAttributeBuilder(); CapabilitiesAttributesBuilder _attributesBuilder = new CapabilitiesAttributesBuilder(); _attributesBuilder.setCapabilities(capabilities); _attributeBuilder.setCapabilitiesAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); }  static Attribute createCapabilities(Version version); static Attribute createHoldTime(int holdTimeMin); static Attribute createHoldTime(int holdTimeMin, int holdTimeMax); static Attribute createIpv4AddPrefix(List<IpPrefix> prefixes, byte flags); static Attribute createIpv4DeletePrefix(List<IpPrefix> prefixes, byte flags); static Attribute createIpv6AddPrefix(List<IpPrefix> prefixes, byte flags); static Attribute createIpv6DeletePrefix(List<IpPrefix> prefixes, byte flags); static Attribute createPeerSequence(List<NodeId> nodesIds); static Attribute createSourceGroupTag(int sgt); static Attribute createSxpNodeId(NodeId nodeId); static byte[] encodeCapability(Capabilities capability); static final byte COMPACT; static final byte OPTIONAL_COMPACT; static final byte NONTRANSITIVE_COMPACT; }