@Test public void testCreateSourceGroupTagException1() throws Exception { exception.expect(SecurityGroupTagValueException.class); AttributeFactory.createSourceGroupTag(65520); }
public static Attribute createSourceGroupTag(int sgt) throws SecurityGroupTagValueException { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.SourceGroupTag); if (sgt < 2 || 65519 < sgt) { throw new SecurityGroupTagValueException(); } byte[] value = ArraysUtil.int2bytesCropp(sgt, 2); if (!Configuration.SET_COMPOSITION_ATTRIBUTE_COMPACT_NO_RESERVED_FIELDS) { value = ArraysUtil.combine(value, new byte[] {0x00, 0x00}); } attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); SourceGroupTagAttributeBuilder _attributeBuilder = new SourceGroupTagAttributeBuilder(); SourceGroupTagAttributesBuilder _attributesBuilder = new SourceGroupTagAttributesBuilder(); _attributesBuilder.setSgt(sgt); _attributeBuilder.setSourceGroupTagAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); }
AttributeFactory { public static Attribute createSourceGroupTag(int sgt) throws SecurityGroupTagValueException { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.SourceGroupTag); if (sgt < 2 || 65519 < sgt) { throw new SecurityGroupTagValueException(); } byte[] value = ArraysUtil.int2bytesCropp(sgt, 2); if (!Configuration.SET_COMPOSITION_ATTRIBUTE_COMPACT_NO_RESERVED_FIELDS) { value = ArraysUtil.combine(value, new byte[] {0x00, 0x00}); } attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); SourceGroupTagAttributeBuilder _attributeBuilder = new SourceGroupTagAttributeBuilder(); SourceGroupTagAttributesBuilder _attributesBuilder = new SourceGroupTagAttributesBuilder(); _attributesBuilder.setSgt(sgt); _attributeBuilder.setSourceGroupTagAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); } }
AttributeFactory { public static Attribute createSourceGroupTag(int sgt) throws SecurityGroupTagValueException { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.SourceGroupTag); if (sgt < 2 || 65519 < sgt) { throw new SecurityGroupTagValueException(); } byte[] value = ArraysUtil.int2bytesCropp(sgt, 2); if (!Configuration.SET_COMPOSITION_ATTRIBUTE_COMPACT_NO_RESERVED_FIELDS) { value = ArraysUtil.combine(value, new byte[] {0x00, 0x00}); } attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); SourceGroupTagAttributeBuilder _attributeBuilder = new SourceGroupTagAttributeBuilder(); SourceGroupTagAttributesBuilder _attributesBuilder = new SourceGroupTagAttributesBuilder(); _attributesBuilder.setSgt(sgt); _attributeBuilder.setSourceGroupTagAttributes(_attributesBuilder.build()); attributeBuilder.setAttributeOptionalFields(_attributeBuilder.build()); return attributeBuilder.build(); }  }
AttributeFactory { public static Attribute createSourceGroupTag(int sgt) throws SecurityGroupTagValueException { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.SourceGroupTag); if (sgt < 2 || 65519 < sgt) { throw new SecurityGroupTagValueException(); } byte[] value = ArraysUtil.int2bytesCropp(sgt, 2); if (!Configuration.SET_COMPOSITION_ATTRIBUTE_COMPACT_NO_RESERVED_FIELDS) { value = ArraysUtil.combine(value, new byte[] {0x00, 0x00}); } attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); SourceGroupTagAttributeBuilder _attributeBuilder = new SourceGroupTagAttributeBuilder(); SourceGroupTagAttributesBuilder _attributesBuilder = new SourceGroupTagAttributesBuilder(); _attributesBuilder.setSgt(sgt); _attributeBuilder.setSourceGroupTagAttributes(_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 createSourceGroupTag(int sgt) throws SecurityGroupTagValueException { AttributeBuilder attributeBuilder = new AttributeBuilder(); attributeBuilder.setFlags(getFlags(COMPACT)); attributeBuilder.setAttributeVariant(AttributeVariant.Compact); attributeBuilder.setType(AttributeType.SourceGroupTag); if (sgt < 2 || 65519 < sgt) { throw new SecurityGroupTagValueException(); } byte[] value = ArraysUtil.int2bytesCropp(sgt, 2); if (!Configuration.SET_COMPOSITION_ATTRIBUTE_COMPACT_NO_RESERVED_FIELDS) { value = ArraysUtil.combine(value, new byte[] {0x00, 0x00}); } attributeBuilder.setLength(value.length); attributeBuilder.setValue(value); SourceGroupTagAttributeBuilder _attributeBuilder = new SourceGroupTagAttributeBuilder(); SourceGroupTagAttributesBuilder _attributesBuilder = new SourceGroupTagAttributesBuilder(); _attributesBuilder.setSgt(sgt); _attributeBuilder.setSourceGroupTagAttributes(_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; }