- Class ImportExportApi Constructor
- Class ImportExportApi Methods
- exportServiceConfiguration
- importServiceConfiguration
- importFlavors
- importFlavors
- importFlavorsFromEasyFormat
- importHttpRefererFlavorsFromEasyFormat
- importZones
- importZones
- importZonesFromEasyFormat
- importProtocols
- importProtocols
- importServices
- importServices
- exportProtocols
- exportProtocols
- exportZones
- exportZones
- exportZonesToEasyFormat
- exportFlavors
- exportFlavors
- exportFlavorsToEasyFormat
- exportServices
- exportServices
- loadListArray
- Class ServiceConfig Methods
- getCalendarList
- getClassificationCfg
- getDynamicSignatureScript
- getPackageList
- getPolicySettings
- getProtocolList
- getProtocolRedirectIndexNameArray
- getProtocolRedirectString
- getRealTimeFrameName
- getServiceList
- getSubNotifications
- getTimeFrameNames
- getProtocolRedirectString
- getZoneList
- isProtocolRedirectable
- setProtocolRedirectString
- setProtocolRedirectString
- setTimeFrameName
- setTimeFrameName
- setTimeFrameNames
Programming with the SCA BB Service Configuration API
Introduction
This chapter is a reference for the main classes and methods of the Cisco SCA BB Service Configuration API. It also contains programming guidelines and code examples.
Service Configuration API Packages
The Service Configuration API includes the following packages:
–
com.cisco.scabb.servconf.mgmt
–
com.cisco.scasbb.backend.classification —Provides representation of the various model objects.
–
com.pcube.apps.engage.common —Provides the classes that the Policy and Subscriber classes use.
–
com.pcube.apps.engage.policy —Provides the classes that define service configurations.
Only com.cisco.scabb.servconf.mgmt is documented in this guide. For details of the other packages, see the Javadoc that is part of the Service Configuration API distribution (see the “Distribution Content” section).
Package com.cisco.scabb.servconf.mgmt
Package com.cisco.scabb.servconf.mgmt contains the following classes:
- SCABB—Provides methods for connecting to the SCE platform; these methods are used for apply and retrieve operations.
- ConnectionApi—Provides the connection handle to the SCE platform.
- ImportExportApi—Provides methods for saving service configurations to and reading service configurations from PQB files. This API also provides methods for importing and exporting parts of service configurations to and from CSV files.
- ServiceConfigApi—Provides methods for creating a new service configuration, and for applying service configurations to and retrieving service configurations from SCE platforms.
- ServiceConfig—Instances of this class are containers of configuration parameters that, when applied to the SCE platform, determine how the service control application performs classification, accounting and reporting, and control over network traffic.
Class SCABB
Class SCABB supplies login and logout methods to the SCE. The handle returned by the login serves all of the Service Configuration API and Subscriber API methods that directly affect the SCE. See the “Class SCABB Methods” section for details.
Class SCABB Methods
Class SCABB methods are explained in the following sections:
login
Connects to the SCE platform; the method returns a handle that all the API methods that affect the device use.
Every login operation must be closed with a logout (ConnectionApi) operation.
- hostName—SCE host address.
- userName—Username.
- password—Password.
- deviceType—Device type. Use the Connection.SE_DEVICE device type to connect to an SCE platform.
The connection, which is a handle passed to all the API methods.
This method throws the ConnectionFailedException if the login fails; you can recover the reason for the failure from the exception.
login
Connects to a device by using an existing SessionObject ; the method returns a handle that all the API methods which affect the device use.
Every login operation must be closed with a logout (ConnectionApi) operation.
sessionObject—Existing SessionObject of the device
The connection, which is a handle passed to all the API methods.
logout
Disconnects from the SCE; the connection cannot be used after this method is called.
connection—Connection that keeps a handle to the connection to the SCE
addNotificationListener
Subscribes the specified Cisco SCA BB notification listener to receive notifications about all the operations performed by the Cisco SCA BB API.
The listener must implement the NotificationListener interface.
removeNotificationListener
Unsubscribes the SCABB listener from receiving notifications about Cisco SCABB API operations.
The removed listener does not receive any more notifications.
listener—NotificationListener to be removed
This method throws the IllegalArgumentException if the listener was never subscribed to listen to Cisco SCABB notifications
getDefaultProtocolFamilies
Gets the default protocol families for this class.
Class ConnectionApi
Class ConnectionApi is a connection handle to the SCE that all the Service Configuration API and Subscriber API methods use.
Class ConnectionApi Methods
Class ConnectionApi contains one method, which is explained in the following section:
isConnected
Class ImportExportApi
Class ImportExportApi is an API for import and export operations. Service configuration elements are imported and exported in CSV formats. Service configuration is imported and exported in XML format.
This section consists of these topics:
Class ImportExportApi Constructor
The Class ImportExportApi constructor is explained in this section:
ImportExportApi
Class ImportExportApi Methods
Class ImportExportApi methods are explained in these sections:
- exportServiceConfiguration
- importServiceConfiguration
- importFlavors
- importFlavors
- importFlavorsFromEasyFormat
- importHttpRefererFlavorsFromEasyFormat
- importZones
- importZones
- importZonesFromEasyFormat
- importProtocols
- importProtocols
- importServices
- importServices
- exportProtocols
- exportProtocols
- exportZones
- exportZones
- exportZonesToEasyFormat
- exportFlavors
- exportFlavors
- exportFlavorsToEasyFormat
- exportServices
- exportServices
- loadListArray
exportServiceConfiguration
importServiceConfiguration
Imports a service configuration from the specified file.
importFlavors
Imports flavors of a specified type from a specified CSV file.
importFlavors
Imports flavors of a specified type from a given input stream.
- servConf—Service configuration into which to import the flavors.
- flavorType—Type of the imported flavors.
- inStream—Input stream from which to import.
This method may throw the ImportExportException if an error occurs during the import.
importFlavorsFromEasyFormat
Imports flavors of a specified type from a specified CSV file in an Easy Format.
- servConf—Service configuration into which to import the flavors.
- file—CSV file from which to import.
This method may throw the ImportExportException if an error occurs during the import.
importHttpRefererFlavorsFromEasyFormat
Imports flavors of an HTTP Referer from a specified CSV file in Easy format.
- servConf—Service configuration into which to import the flavors.
- file—CSV file from which to import.
This method may throw the ImportExportException if an error occurs during the import.
importZones
Imports zones from a specified CSV file.
This method may throw the ImportExportException if an error occurs during the import.
importZones
Imports zones from a given input stream.
- servConf—Service configuration into which to import the zones.
- inStream—Input stream from which to import.
This method may throw the ImportExportException if an error occurs during import.
importZonesFromEasyFormat
Imports zones from a specified CSV file in Easy format.
This method may throw the ImportExportException if an error occurs during the import.
importProtocols
Imports protocols from a specified CSV file.
- servConf—Service configuration into which to import the protocols.
- file—CSV file from which to import.
This method may throw the ImportExportException if an error occurs during the import.
importProtocols
Imports protocols from a given input stream.
- servConf—Service configuration into which to import the protocols.
- inStream—Input stream from which to import.
This method may throw the ImportExportException if an error occurs during the import.
importServices
Imports services from a specified CSV file.
- servConf—Service configuration into which to import the services.
- file—CSV file from which to import.
This method may throw the ImportExportException if an error occurs during the import.
importServices
Imports services from a given input stream.
- servConf—Service configuration into which to import the services.
- inStream—Input stream from which to import.
This method may throw the ImportExportException if an error occurs during the import.
exportProtocols
Exports protocols to a specified file in a CSV format.
This method may throw the ImportExportException if an error occurs during the export.
exportProtocols
Exports protocols to a given output stream in a CSV format.
This method may throw the ImportExportException if an error occurs during the export.
exportZones
Exports zones to a specified file in a CSV format.
This method may throw the ImportExportException if an error occurs during the export.
exportZones
Exports zones to a given output stream in a CSV format.
This method may throw the ImportExportException if an error occurs during the export.
exportZonesToEasyFormat
Exports zones to a specified CSV file in Easy format.
This method may throw the ImportExportException if an error occurs during the export.
exportFlavors
Exports flavors of a specified type to a specified file in a CSV format.
- flavors—List of flavors to export.
- flavorType—Type of the exported flavors.
- file—File to which to export.
This method may throw the ImportExportException if an error occurs during the export.
exportFlavors
Exports flavors of a specified type to a given output stream in a CSV format.
- flavors—List of flavors to export.
- flavorType—Type of the exported flavors.
- outStream—Output stream to which to export.
This method may throw the ImportExportException if an error occurs during the export.
exportFlavorsToEasyFormat
Exports flavors of a specified type to a specified file in an Easy CSV format
This method may throw the ImportExportException if an error occurs during the export.
exportServices
Exports services from a service configuration to a file in CSV format.
This method may throw the ImportExportException if an error occurs during the export.
exportServices
Exports services from a service configuration to an output stream in CSV format.
- servConf—Service configuration from which to export the services.
- outStream—Output stream to which to export.
This method may throw the ImportExportException if an error occurs during the export.
loadListArray
Deprecated—Used only for 2.57 host list and IP list:
- It converts 2.57 CSV host-list files into 3.0 CSV HTTP URL flavor files.
- It converts 2.57 CSV IP-list files into 3.0 CSV zone files.
For loading 3.0 CSV files, use the methods importFlavors(ServiceConfig, FlavorType, File) and importZones(ServiceConfig, File).
Class ServiceConfigApi
Class ServiceConfigApi exposes Service Configuration API methods. All of these methods get or set data located in the SCE, and therefore, require a connection to the SCE platform.
Class ServiceConfigApi Methods
Class ServiceConfigApi methods are explained in these sections:
applyServiceConfiguration
applyServiceConfiguration
applyServiceConfiguration
Applies a service configuration to the specified SCE.
- connectionApi—Connection API that keeps a handle to the connection to the SCE.
- servConf—Service configuration to apply.
- updateCm—Whether the Collection Manager for the specified SCE will be updated with the specified service configuration values.
- cmIpRemap—Map from the Collection Manager IP address as configured in the SCE, to the actual CM addresses.
- cmUpdateMethod—Method to use to connect to the Collection Manager.
- rpcPort—Port number for the Collection Manager RPC connection
- forceTemplateVirtualLinksInVlMode
This method may throw the following exceptions:
PolicyAPI.DC_UPDATE_METHOD_RPC, PolicyAPI.DC_DEFAULT_RPC_PORT
applyServiceConfiguration for 2M URL Support
Applies a service configuration to the specified SCE.
- connectionApi—Connection API that keeps a handle to the connection to the SCE.
- servConf—Service configuration to apply.
- updateCm—Whether the Collection Manager for the specified SCE will be updated with the specified service configuration values.
- cmIpRemap—Map from the Collection Manager IP address as configured in the SCE, to the actual CM addresses.
- cmUpdateMethod—Method to use to connect to the Collection Manager.
- rpcPort—Port number for the Collection Manager RPC connection
- forceTemplateVirtualLinksInVlMode
- isPqbSaveReqd—This is applicable only for this feature. Set this policy as False, if set as True the policy will not be applied.
retrieveServiceConfiguration
Retrieves the service configuration loaded in the specified SCE.
updateValuesIni
Updates the CM with data from the SCE platform service configuration.
updateValuesIni
Updates the CM with data from the SCE platform service configuration.
validateServiceConfiguration
Validates a service configuration.
servConf—The service configuration to validate.
A vector with warning messages about rules that might have undesirable results.
PolicyValidator.validatePolicy(com.pcube.apps.engage.policy.Policy)
importServConf
Loads the service configuration from a PQB file.
exportServConf
importDefaultServConf
throws ImportExportException
Loads the default service configuration.
Class ServiceConfig
Class ServiceConfig is the whole set of lists, protocols, services, and packages that an ISP has defined. The service configuration is applied to the ServiceConfig Domain SCE platforms and sets their application parameters to regulate subscriber flows.
Class ServiceConfig Methods
Class ServiceConfig methods are explained in these sections:
- getCalendarList
- getClassificationCfg
- getDynamicSignatureScript
- getPackageList
- getPolicySettings
- getProtocolList
- getProtocolRedirectIndexNameArray
- getProtocolRedirectString
- getRealTimeFrameName
- getServiceList
- getSubNotifications
- getTimeFrameNames
- getProtocolRedirectString
- getZoneList
- isProtocolRedirectable
- setProtocolRedirectString
- setProtocolRedirectString
- setTimeFrameName
- setTimeFrameName
- setTimeFrameNames
getCalendarList
getClassificationCfg
getDynamicSignatureScript
getPackageList
getPolicySettings
Gets the service configuration settings for this service. These settings are general system settings for the SCE platforms in this service configuration domain.
getProtocolList
Gets this service configuration protocol list. The protocols in this list are referred to by the service configuration services.
getProtocolRedirectIndexNameArray
getProtocolRedirectString
Gets the redirect address for the protocol in a certain index in its redirect string array.
Redirection is part of the protocol specification, and exists for only a few predefined protocols.
This method may throw the ItemNotFoundException if there is no such predefined protocol in this service configuration ProtocolArray, or if the redirect index is out of bound
getRealTimeFrameName
throws ItemNotFoundException
Gets the predefined API name for a certain TimeFrame.
This method may throw the ItemNotFoundException if there is no such alias in this service configuration.
getServiceList
getSubNotifications
Gets the subscriber notifications as configured in the service configuration.
getTimeFrameNames
Gets the time frame names this service configuration has assigned to the different TimeFrames.
These aliases allow time frames to have meaningful names.
The returned String array keeps in index X, the alias of the TimeFrame index X.
The String array of this service configuration time frame names.
getProtocolRedirectString
throws ItemNotFoundException
Gets the default redirect address for the protocol.
Redirection is part of the protocol specification, and exists for only a few predefined protocols.
This method may throw the ItemNotFoundException if there is no such predefined protocol in this service configuration ProtocolArray.
getZoneList
Gets this service configuration IP, IP ranges, and host lists array. These lists are referred to by the service configuration services of this service.
isProtocolRedirectable
throws ItemNotFoundException
Checks if a specified protocol supports redirecting.
Redirection is part of the protocol specification, and exists for only a few predefined protocols.
true if the protocol support redirection, false otherwise.
This method may throw the ItemNotFoundException if there is no such predefined protocol in this service configuration ProtocolArray.
setProtocolRedirectString
Sets the address to which to redirect a certain flow. The redirection occurs when a rule has an ACCESS_BLOCK_AND_REDIRECT access mode for a certain service that uses the desired protocol. The setting is done to a certain String in the redirect String array. The rule chooses which redirect String to use from the redirect String array.
setProtocolRedirectString
Sets the default address to which to redirect a certain flow. The redirection occurs when a rule has an ACCESS_BLOCK_AND_REDIRECT access mode for a certain service that uses the desired protocol.
setTimeFrameName
Sets an alias for the TimeFrame that has a given index.
setTimeFrameName
Sets an alias for the specified TimeFrame.
setTimeFrameNames
Service Configuration API Programming Guidelines
Connections to the SCE Platform
Make sure that the connections you create by using any of the login() methods are properly closed by using logout() (see “logout” section).
Service Configuration API Code Examples
This section gives several code examples of Service Configuration API usage.
- Applying a Service Configuration
- Updating Zones Automatically
- Listing Names of Services and Packages
Applying a Service Configuration
The following example applies a new service configuration to the SCE platform that is specified in the command line:
Note To apply the PQB which is created with 10GBE Platform via GUI, you must include the following line prior to the call of ServiceConfigApi.applyServiceConfiguration() method:
Updating Zones Automatically
The following example updates an SCE with zone IP addresses (specified in a CSV file):
Listing Names of Services and Packages
The following example prints the names of the services and packages that are in a service configuration:
Feedback