All Downloads are FREE. Search and download functionalities are using the official Maven repository.

es.tid.pce.pcep.objects.SwitchLayer Maven / Gradle / Ivy

The newest version!
package es.tid.pce.pcep.objects;

import java.util.LinkedList;

import es.tid.pce.pcep.PCEPProtocolViolationException;
import es.tid.pce.pcep.constructs.SwitchEncodingType;

/**
 * 

Represents a SWITCH-LAYER Object, as defined in http://tools.ietf.org/id/draft-ietf-pce-inter-layer-ext-04.txt

*

From draft-ietf-pce-inter-layer-ext-04.txt, section 3.2. SWITCH-LAYER Object

* The SWITCH-LAYER object is optional on a PCReq message and specifies switching layers in which a path MUST, or MUST NOT, be established. A switching layer is expressed as a switching type and encoding type. The SWITCH-LAYER object MUST NOT be used on a PCReq unless an INTER-LAYER object is also present on the PCReq message. The SWITCH-LAYER object is optional on a PCRep message, where it is used with the NO-PATH object in the case of unsuccessful path computation to indicate the set of constraints that could not be satisfied. SWITCH-LAYER Object-Class is to be assigned by IANA (recommended value=19) SWITCH-LAYER Object-Type is to be assigned by IANA (recommended value=1) The format of the SWITCH-LAYER object body is as follows: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LSP Enc. Type |Switching Type | Reserved |I| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | . | // . // | . | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LSP Enc. Type |Switching Type | Reserved |I| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Each row indicates a switching type and encoding type that must or must not be used for specified layer(s) in the computed path. The format is based on [RFC3471], and has equivalent semantics. LSP Encoding Type (8 bits): see [RFC3471] for a description of parameters. Switching Type (8 bits): see [RFC3471] for a description of parameters. I flag (1 bit): the I flag indicates whether a layer with the specified switching type and encoding type must or must not be used by the computed path. When the I flag is set (one), the computed path MUST traverse a layer with the specified switching type and encoding type. When the I flag is clear (zero), the computed path MUST NOT enter or traverse any layer with the specified switching type and encoding type. When a combination of switching type and encoding type is not included in SWITCH-LAYER object, the computed path MAY traverse a layer with that combination of switching type and encoding type. A PCC may want to specify only a Switching Type and not an LSP Encoding Type. In this case, the LSP Encoding Type is set to zero. * @author ogondio * */ public class SwitchLayer extends PCEPObject { private LinkedList switchLayers; public SwitchLayer(){ this.setObjectClass(ObjectParameters.PCEP_OBJECT_CLASS_SWITCH_LAYER); this.setOT(ObjectParameters.PCEP_OBJECT_TYPE_SWITCH_LAYER); switchLayers=new LinkedList(); } public SwitchLayer(byte []bytes, int offset) throws MalformedPCEPObjectException{ super(bytes, offset); switchLayers=new LinkedList(); decode(); } /** * Encode SwitchLayer PCEP Object */ public void encode() { int len=4;//The four bytes of the header for (int k=0; k=ObjectLength){ fin=true; } } } public LinkedList getSwitchLayers() { return switchLayers; } public void setSwitchLayers(LinkedList switchLayers) { this.switchLayers = switchLayers; } @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((switchLayers == null) ? 0 : switchLayers.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; SwitchLayer other = (SwitchLayer) obj; if (switchLayers == null) { if (other.switchLayers != null) return false; } else if (!switchLayers.equals(other.switchLayers)) return false; return true; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy