Class SyncUtil


  • public class SyncUtil
    extends Object
    • Constructor Detail

      • SyncUtil

        public SyncUtil()
    • Method Detail

      • isSynchronizable

        public static boolean isSynchronizable​(String ifName)
        To Filter which if names could be synchronized
        Parameters:
        ifName - the port or interface name
        Returns:
        boolean if should be synchronized false if not
      • wrapPortName

        public static BusinessObject wrapPortName​(BusinessObject obj)
        Checks if the object is a port an wraps the name into a standardized name
        Parameters:
        obj - a given object
        Returns:
        the object with the port name wrapped
      • wrapPortName

        public static BusinessObjectLight wrapPortName​(BusinessObjectLight obj)
        Checks if the object is a port an wraps the name into a standardized name
        Parameters:
        obj - a given object
        Returns:
        the object with the port name wrapped
      • normalizeVfiName

        public static String normalizeVfiName​(String rawVfi)
        Cleans de VFI names removes de (VFI)
        Parameters:
        rawVfi - name raw vfi name
        Returns:
        normalized vfi name
      • normalizePortName

        public static String normalizePortName​(String interfaceName)
        Wraps the port name into a standardized port name gi, te, fa, pos
        Parameters:
        interfaceName - raw port name
        Returns:
        normalized port name
      • compareLegacyPortNames

        public static boolean compareLegacyPortNames​(String oldName,
                                                     String oldClassName,
                                                     String newName,
                                                     String newClassName)
        Compare the old port names with the new name, the first load of the SNMP sync depends of the name of the ports because this names are the only common point to start the search and update/creation of the device. Supported cases: Ge, gi1/1/13, Gi8/18, GigabitEthernet0/9, Tengi0/0/0, POS0/1/0
        Parameters:
        oldName - the old port name
        oldClassName - the old port class
        newName - the new port name
        newClassName - the new port class
        Returns:
        boolean if the name match
      • compareAttributes

        public static HashMap<String,​String> compareAttributes​(HashMap<String,​String> oldObjectAttributes,
                                                                     HashMap<String,​String> newObjectAttributes)
        Compares the old and the new list of attributes an return the changes
        Parameters:
        oldObjectAttributes - the old list of attributes
        newObjectAttributes - the list read it from SNMP
        Returns:
        the a map with the attributes changed
      • compareAttributes

        public static HashMap<String,​String> compareAttributes​(HashMap<String,​String> oldObjectAttributes,
                                                                     javax.json.JsonObject newObjectAttributes)
        Compares the old and the new list of attributes an return the changes
        Parameters:
        oldObjectAttributes - the old list of attributes
        newObjectAttributes - the list read it from SNMP
        Returns:
        the a map with the attributes changed
      • parseAttributesToJson

        public static javax.json.JsonObject parseAttributesToJson​(HashMap<String,​String> attributes)
        Parse a hash map with the attributes of the objects to a JSON format
        Parameters:
        attributes - the attributes to create the JSON
        Returns:
        a JSON object with the attributes
      • parseOldAttributesToJson

        public static javax.json.JsonObject parseOldAttributesToJson​(HashMap<String,​String> attributes)
        Parse a hash map with the attributes of the objects to a JSON format
        Parameters:
        attributes - the attributes to create the JSON
        Returns:
        a JSON object with the attributes
      • joBuilder

        public static javax.json.JsonObjectBuilder joBuilder​(javax.json.JsonObject jo)
        Utility that allow to edit a created jSON
        Parameters:
        jo - created json object
        Returns:
        the edited JSON with new fields
      • jArrayBuilder

        public static javax.json.JsonArrayBuilder jArrayBuilder​(javax.json.JsonArray ja)
        Utility that allow to edit a created jSON Array
        Parameters:
        ja - created json array
        Returns:
        the edited JSON with new fields
      • parseMibTable

        public static HashMap<String,​List<String>> parseMibTable​(String mibTableName,
                                                                       HashMap<String,​org.snmp4j.smi.OID> mibTable,
                                                                       List<List<String>> tableAsString)
        In providers, maps the data table got from SNMP into a Map to
        Parameters:
        mibTableName -
        mibTable -
        tableAsString -
        Returns:
      • updateView

        public static byte[] updateView​(byte[] structure,
                                        BusinessObjectLight device,
                                        int side)
        Updates the MPLS view after sync
        Parameters:
        structure - MPLS view structure
        device - device under sync
        side - which side is been sync
        Returns:
        updated vMPLS view structure
      • createMplsView

        public static byte[] createMplsView​(List<BusinessObjectLight> devices,
                                            BusinessObjectLight link)
        Creates a MPLS view if doesn't exist
        Parameters:
        devices - the device under sync
        link - the new MPLS link
        Returns:
        a new MPLS view structure