<!-- The Provisioning Template DTD -->

<!ELEMENT Template ( Stage+ ) >

<!-- name - Must be uniquely named  -->
<!-- label - Template label to display -->        
<!-- description - Help description -->
<!-- helpurl - Help file that will give a complete explanation of this template.                                                 Note path   should be relative to the application  root dir or to web-server base directory  -->
<!-- owner - The user or the owner who is defining or provisioning this template -->
<!-- group - For future use -->
<!-- modifiedTime - The time at which this template is created / modified -->
<!-- displayForms - If the value of this attribute is 'tree' then the Forms will be displayed in Tree format  -->
<!-- statusMessage - The message that will be displayed in the status text area.-->
<!ATTLIST Template
name CDATA #REQUIRED
label CDATA #IMPLIED               
description CDATA #IMPLIED
helpurl CDATA #IMPLIED         
owner CDATA #REQUIRED              
group CDATA #IMPLIED               
modifiedTime CDATA #IMPLIED
displayForms (tree | tab) "tab" 
statusMessage CDATA #IMPLIED>


<!-- Following attrs used only during template-based operations -->
<!-- when - Scheduling data - The various possible ways of specifying time:
     1 ) "hh:mm AM/PM" (OR) "hh:mm:ss AM/PM" - where hh - hour, mm - minute, ss - second
     2 ) "now + howMany unit" - where howMany - any integer, unit - hour/minute/second/day/week
     3 ) "MMMM dd,yyyy hh:mm:ss AM/PM" - where MMMM - month in text, dd - date, yyyy - year, hh - hour, mm - minute, ss - second 
	 4 ) time in number of milliseconds since January 1, 1970, 00:00:00 GMT.
Note: * hours in 12-hour clock basis(ie., 1 - 12)
      * Never miss intermediate spaces in the 3rd format.
 -->  
<!-- period - Periodic scheduling data -  The possible way of specifying periodic scheduling is:
	  "howMany unit" - where howMany - any integer, unit - hour/minute/second/day/week
     Note that the number of times scheduling to be done is specified using "count" attribute.
-->
<!-- count - count data for periodic scheduling - Specifies the number of times scheduling to be done.
     Periodic scheduling can be done infinite times by not specifying this attribute or by assigning 0 to it.
-->
<!-- until - end time data for periodic scheduling - The various possible ways of specifying time:
     1 ) "hh:mm AM/PM" (OR) "hh:mm:ss AM/PM" - where hh - hour, mm - minute, ss - second
     2 ) "when + howMany unit" - where howMany - any integer, unit - hour/minute/second/day/week
     3 ) "MMMM dd,yyyy hh:mm:ss AM/PM" - where MMMM - month in text, dd - date, yyyy - year, hh - hour, mm - minute, ss - second 
	 4 ) time in number of milliseconds since January 1, 1970, 00:00:00 GMT.
Note: * hours in 12-hour clock basis(ie., 1 - 12)
      * Never miss intermediate spaces in the 3rd format.
 -->
<!-- enabled - Server assigned. User can modify only during runtime using API. can be either true or false. If true, the template is enabled for execution. The default value is "true".-->
<!-- priority - specifies the priority of the template which is scheduled for execution. It can be either "1" or "2".
     1) "1" - for normal priority template
     2) "2" - for high priority template
     The default priority is "1".
 -->
<!--
  triggerHandler - name of a class file. This also includes package in which it is placed. This class should extend com.adventnet.nms.provisioning.server.ProvisioningTrigger class
	example com.adventnet.nms.provisioning.server.TopoTrigger
-->
<!--
  triggerCriteria - name of a criteria file. This is mandatory for com.adventnetmnms.provisioning.server.TopoTrigger and com.adventnet.nms.provisioning.server.EventTrigger class
-->
<!--
  autoDeregister - can be either true or false. If true provisioning module will stop listening after the arrival of first useful trigger.Its default value is true.
-->
<!ATTLIST Template  
when CDATA #IMPLIED   
period CDATA #IMPLIED
count CDATA #IMPLIED
until CDATA #IMPLIED 
enabled (true | false) "true" 
priority (1 | 2) "1" 
triggerHandler CDATA #IMPLIED
triggerCriteria CDATA #IMPLIED
autoDeregister (true | false) "true" > 

<!-- Following attrs used only for rendering the screens -->
<!-- ok - Text to display for ok button -->
<!-- close - Text to display for close button -->
<!-- next - Text to display for next button -->
<!-- back - Text to display for back button -->
<!-- finish - Text to display for finish button -->
<!ATTLIST Template  
ok CDATA #IMPLIED                  
close CDATA #IMPLIED               
next CDATA #IMPLIED                
back CDATA #IMPLIED                
finish CDATA #IMPLIED >

<!-- stageId - Server Assigned - The label of the Stage that is currrently being executed in the server.-->
<!-- formId -  Server Assigned - The comma separated ids of Forms which need to be shown in the Client for collecting User Inputs. -->
<!-- operationId - Server Assigned - The unique identifier of the provisioning operation. -->
<!-- scheduleId - Server Assigned - The unique identifier of the scheduled provisioning operation.-->
<!-- appendResult - If it is set to true, then ConfigTask result will be appended when it is executed more than once. Otherwise results will be overwritten. -->
<!-- backupPlaceHolders - Server Assigned - This will be set to true, if the template contains GoTo element, for the proper handling of PlaceHolders like '$InventoryInput$..'.  -->
<!-- stylesheet - The stylesheet to be used for the Template. stylesheet attribute will be added when the layout of the forms present in the Template is changed using the LayoutManager tool-->
<!-- noOfTimesExecuted - Server Assigned - This will be used to find how many times the 
periodic scheduling Operation is done.-->
<!-- scheduledTime - Server Assigned - This will show the schedule time of the template.-->

<!ATTLIST Template
stageId CDATA #IMPLIED
formId CDATA #IMPLIED
operationId CDATA #IMPLIED
scheduleId CDATA #IMPLIED
appendResult (true | false) #IMPLIED
backupPlaceHolders (true | false) #IMPLIED
stylesheet CDATA #IMPLIED
noOfTimesExecuted CDATA #IMPLIED
scheduledTime CDATA #IMPLIED>

<!-- Includes initialization, config task, user input, and inventory information -->
<!-- May also include template parameters substituted when loading -->

<!ELEMENT Stage ( (Initialization|InventoryInput|NEInput|Form|Script|GoTo)*,(ConfigTask|InventoryUpdate|Script|GoTo)* ) >
<!ATTLIST Stage
label CDATA #REQUIRED >

<!-- To initialize contexts-->
<!ELEMENT Initialization (Context+) >

<!-- To define contexts-->
<!ELEMENT Context EMPTY >
<!--
handleName 		-	an unique name for the context
contextType 	-	This should be sql.
URL	 			-	The database URL. Eg. jdbc:mysql://localhost/ProvDB
driverName		-	Database driver name used by SQL contexts.
userName		-	Database user name used by SQL contexts.
password		-	Database password used by SQL contexts.
persistPolicy	-	if this is true, this context can also be used by any other templates
					If false, it can used only in this template.
timeout 		-	if persistPolicy is false and the timeout is set to zero, this context only used by the particular Operation. Otherwise this context stored in the memory upto the specified time. It accept value in seconds. 					
-->

<!ATTLIST Context
handleName CDATA #REQUIRED
contextType CDATA #REQUIRED
URL CDATA #REQUIRED
driverName CDATA #REQUIRED
userName CDATA #IMPLIED
password CDATA #IMPLIED
persistPolicy (true|false) "false" 
timeout  CDATA #IMPLIED>

<!-- To gather prior inventory data -->
<!ELEMENT InventoryInput (SQLInput|MOInput)* >

<!-- id - Name matching attribute -->
<!-- MOName - Object name in Inventory DB -->
<!-- MOField - Object field in Inventory DB -->
<!-- default - Default Field value -->
<!-- value - Field value returned from DB lookup -->         
<!-- inventoryHandler - Fully qualified class name of the InventoryHandler implementation to get InventoryInput. -->
<!-- useInventoryService - Which APIService is used to collect the InventoryInput.The possible values are "TopoAPI" and "InventoryAPI". Default value is "TopoAPI". -->

<!ATTLIST InventoryInput           
id CDATA #IMPLIED                 
MOName CDATA #IMPLIED              
MOField CDATA #IMPLIED             
default CDATA #IMPLIED             
value CDATA #IMPLIED
inventoryHandler CDATA #IMPLIED 
useInventoryService (TopoAPI|InventoryAPI) "TopoAPI">             

<!-- To gather prior sql data -->
<!ELEMENT SQLInput EMPTY >
<!--
contextHandleName	-	name of the initialized context.
id					-	an Unique id associated with this SQLInput tag.
sqlCommand 			-	A sql command which can fetch a value for this SQLInput.
useResultSet		-   This attribute has the value of any SQLInput id. The ResultSet
					-   obtained from that SQLInput(corresponding to the id) should be used 				   -   to populate this SQLInput value field.
default				-	Default Field value
row 				-  	Which row in the ResultSet is used to populate the SQLInput value					   -   field. Default value is 1 
column				-   Which column in the ResultSet is used to populate the SQLInput 
					-   value field. Default value is 1.
value				-	Field value returned from DB lookup
-->
<!ATTLIST SQLInput
contextHandleName CDATA #IMPLIED
id CDATA #REQUIRED
sqlCommand CDATA #IMPLIED
useResultSet CDATA #IMPLIED
default CDATA #IMPLIED
row CDATA "1"
column CDATA "1"
value CDATA #IMPLIED>


<!-- To gather prior inventory data from Provisioning database-->
<!ELEMENT MOInput EMPTY >
<!--
id		- an Unique id associated with this MOInput tag.
MOName 	- Object name in Inventory DB
MOField - Object field in Inventory DB
default	- Default Field value
value	- Field value returned from DB lookup
useInventoryService - Which APIService is used to collect the InventoryInput.The possible values are "TopoAPI" and "InventoryAPI". Default value is "TopoAPI".
-->

<!ATTLIST MOInput
id CDATA #REQUIRED
MOName CDATA #REQUIRED
MOField CDATA #REQUIRED             
default CDATA #IMPLIED            
value CDATA #IMPLIED
useInventoryService (TopoAPI|InventoryAPI) "TopoAPI">             

<!-- For prior NE data -->
<!ELEMENT NEInput ( ProtocolMap, Attribute*  ) >  

<!-- Defines User Input Forms -->
<!ELEMENT Form ( Table | UserInput* ) > 

<!-- title - Form Title -->   
<!-- description - Help description -->    
<!ATTLIST Form
id CDATA #REQUIRED
title CDATA #REQUIRED              
description CDATA #IMPLIED >
	 
<!ELEMENT Table (UserInput*) >
<!-- The Table Element. There can be only one Table per Form. A Table can contain UserInput elements 
     The Qualifier for the UserInput will be taken as the Editor for that Table cell. 
     If a Form contains Table, then there should be no elements outside the Table tag.-->

<!ATTLIST Table 
    rows CDATA #REQUIRED
	columns CDATA #REQUIRED
	columnWidths CDATA #IMPLIED>

	<!-- columnWidths should contain comma seperated integers.
	  Eg., Table rows="3" columns="3" columnWidths="130,150,80"
      If a table has 3 rows and 3 columns then there should be 3*3 = 9 UserInputs present under it.
      If a table has 'n' columns then the TableHeader will contain the label of first 'n' UserInputs. -->

<!-- For user inputs --> 
<!ELEMENT UserInput ( Qualifier?  ) > 

<!-- User inputs to parameterize wherever needed -->
<!-- id - To match input data --> 
<!-- name - Defaults to attr name -->
<!-- label - Label to use -->
<!-- description - Help description --> 
<!-- default - Default value to use -->
<!-- value - Field value returned from user -->
<!-- editable - Whether the component is editable -->  
<!-- required - If this field is true, this UserInput component must get input from the user. -->
<!ATTLIST UserInput                   
id CDATA  #REQUIRED
name CDATA #IMPLIED
label CDATA #REQUIRED
description CDATA #IMPLIED
default CDATA #IMPLIED
value CDATA #IMPLIED                
editable (true | false)  "true" 
required (true | false)  "false" >     

<!-- Qualifies user inputs, e.g. enums -->
<!ELEMENT Qualifier ( Enum* ) >       

<!-- type - Display hint e.g. numerictextfield etc -->
<!-- range - Specifies allowed range, e.g. 0-100  -->  
<!ATTLIST Qualifier                      
type CDATA #REQUIRED                  
range CDATA #IMPLIED >
                
<!-- Enumerated value -->
<!ELEMENT Enum EMPTY>

<!-- name - Name/label for enum value -->
<!-- value - Enum value -->                 
<!ATTLIST Enum                         
name CDATA #REQUIRED                  
value CDATA #REQUIRED >               

<!-- Defines the Task -->
<!ELEMENT ConfigTask ( ProtocolMap?, DeviceTaskMap*, Attribute*, GroupAttribute* ) >

<!-- taskName - Name of the task which should be unique for an user --> 
<!-- isNewTask - Whether the task is a new or an existing task -->
<!-- isOverWrite - Flag to overwrite if a task with this task name already exists -->  
<!-- isSequential - Flag to configure the devices in sequential order -->
<!-- rollbackDocument - The name of the rollback task -->
<!-- rollbackNeeded - Whether the rollback should be done on failure of configuration -->
<!-- rollbackType - whether the rollback is current configuration or document-->  
<!-- combinedTask - Whether the task is a combination of subtasks -->
<!-- version - The version of the task - for future use only -->  
<!-- description - The detailed description about the task -->
<!ATTLIST ConfigTask
taskName CDATA #REQUIRED                   
isTemplate (true | false) "false" 
isNewTask (true | false) "true"               
isOverwrite (true | false) "false"           
isSequential (true | false ) "false"         
rollbackDocument CDATA #IMPLIED            
rollbackNeeded (true | false) "false"        
rollbackType CDATA #IMPLIED                
combinedTask (true | false) #IMPLIED         
persistence (true | false) "true"
version CDATA  "1.0" 
description  CDATA #IMPLIED 
rollbackLevel CDATA #IMPLIED
deviceResult (true | false) "false"
interPacketDelay CDATA #IMPLIED
resultHandler CDATA #IMPLIED
dataSourceName CDATA #IMPLIED
encoding CDATA #IMPLIED >

<!-- Protocol specific details -->
<!ELEMENT ProtocolMap (Device|DeviceList)* > 

<!-- name - Name of the protocol -->
<!-- mibsToBeLoaded - Protocol specific info -->
<!ATTLIST ProtocolMap          
name CDATA #REQUIRED                  
taskName CDATA #IMPLIED
mibsToBeLoaded CDATA #IMPLIED >        

<!-- Defines device details -->
<!ELEMENT Device EMPTY >

<!-- Common device parameters -->               
<!ATTLIST Device 
host CDATA #REQUIRED                
port CDATA #REQUIRED
retries CDATA #IMPLIED
MOName CDATA #IMPLIED
timeout CDATA #IMPLIED> 

<!-- SNMP specific device parameters -->
<!ATTLIST Device 
community CDATA #IMPLIED               
version CDATA #IMPLIED 
contextId CDATA #IMPLIED 
contextName CDATA #IMPLIED 
authProtocol CDATA #IMPLIED
authPassword CDATA #IMPLIED
privPassword CDATA #IMPLIED>

<!-- Telnet specific device parameters -->
<!ATTLIST Device 
loginName CDATA #IMPLIED              
password CDATA #IMPLIED 
loginPrompt CDATA #IMPLIED 
passwordPrompt CDATA #IMPLIED 
shellPrompt CDATA #IMPLIED >

<!-- Defines deviceList details -->
<!ELEMENT DeviceList EMPTY> 

<!-- name - Name of the device list -->
<!ATTLIST DeviceList
name CDATA #REQUIRED>                 

<!-- Defines the subtask and devices mapping. This tag will be used when user wants to combine multiple tasks -->
<!ELEMENT DeviceTaskMap ( Device|DeviceList )* >  

<!-- taskName - The subtask name -->
<!ATTLIST DeviceTaskMap
taskName CDATA #REQUIRED >

<!-- Defines the attributes of a task -->
<!ELEMENT Attribute ( ColumnAttribute* ) >

<!-- Common attributes -->
<!ATTLIST Attribute
identifier CDATA #REQUIRED
index CDATA #IMPLIED
label CDATA #IMPLIED
type CDATA #IMPLIED
default CDATA #IMPLIED 
value CDATA #IMPLIED 
MOName CDATA #IMPLIED >

<!-- TL1 Attributes --> 
<!ATTLIST Attribute
commandCode CDATA #IMPLIED
targetID CDATA #IMPLIED  
accessID CDATA #IMPLIED  
generalBlock CDATA #IMPLIED  
messagePayLoadBlock CDATA #IMPLIED >

<!-- Telnet Attributes In case of telnet,                                                                                       - identifier will be the command and                                                                                        - value will be the prompt -->

<!--
     Tftp Attributes
          - identifier will be the command (put/get operation)
-->
<!ATTLIST Attribute
binaryMode CDATA #IMPLIED  
srcFileName CDATA #IMPLIED  
destFileName CDATA #IMPLIED >

<!-- Defines the columnar attribtes of a table -->
<!ELEMENT ColumnAttribute EMPTY > 
<!ATTLIST ColumnAttribute 
identifier CDATA #REQUIRED 
type CDATA #IMPLIED
default CDATA #IMPLIED 
value CDATA #IMPLIED 
label CDATA #IMPLIED   
MOName CDATA #IMPLIED >

<!-- To represent attributes as a group -->
<!ELEMENT GroupAttribute ( UserAttribute?,Attribute+ ) >

<!-- User specific private information -->    
<!ELEMENT UserAttribute ( Property+ ) >                   
<!ELEMENT Property EMPTY >
<!-- name - Attr name by default -->
<!-- value - Attr value by default -->
<!ATTLIST Property 
name CDATA #REQUIRED 
value CDATA #REQUIRED >

<!-- Defines Inventory Updates -->
<!-- These tags update the inventory data  -->
<!ELEMENT InventoryUpdate ( MOUpdate|SQLUpdate|Script )* >
<!-- Inventory Update Details -->
<!ELEMENT MOUpdate ( Property+ )>

<!-- MOName - Device name by default -->
<!-- MOClass - ManagedObject to be added/updated into the database-->
<!-- isNew - Criteria to add/update the MOClass into the database-->
<!-- when - Criteria to update the DB -->                            
<!ATTLIST MOUpdate                                   
MOName CDATA #REQUIRED
MOClass CDATA #IMPLIED
isNew (true | false) "false"
when (onSuccess | always | onFailure) "onSuccess" >
<!-- to do SQL updations-->
<!ELEMENT SQLUpdate EMPTY>
<!--
contextHandleName	-	name of the initialized context.
sqlCommand 			-	A sql command which can do database updations.
when - Criteria to update
-->
<!ATTLIST SQLUpdate
contextHandleName CDATA #IMPLIED
sqlCommand CDATA #REQUIRED
when (onSuccess | always | onFailure) "onSuccess" >

<!ELEMENT Script (#PCDATA|InventoryInput|NEInput|ConfigTask|InventoryUpdate|GoTo)* >

<!ELEMENT GoTo EMPTY>

<!ATTLIST GoTo
label CDATA #REQUIRED >
