Technical Blog Post
Abstract
Netcool Configuration Manager (NCM): Do you want a "virtual" device?
Body
Alright, the official name given to such "virtual" device is ---- file-based access method.
https://www.ibm.com/support/knowledgecenter/en/SS7UH9_6.4.2/ncm/wip/adm/reference/ncm_adm_devcom_filebasedaccess.html
What? It's not a "device", but a "method"? Hang on there and read on...
First of all, why would you need a "virtual" (or rather a "file-based" device)? The answer is simple. You may have a need to test certain NCM features on a production device. However, you do not want to take any risk to mess up the, well, PRODUCTION device. Hence, you thought...how nice will it be to have a similar device that you can "play" with a little. Of course, it would be nicer if it does not involve any extra expenditure!
The "file-based access method" is your answer!
While there's an official documentation about how you can create a "file-based" device, it can be a bit overwhelming for people that do not have a lot of knowledge of NCM.
The intention of this blog entry is to make the task of creating a "file-based" device easy...as ABC...in a step-by-step manner! And it comes with screenshots :)
***
HOW TO CREATE FILE-BASED DEVICE
STEP 1:
Obtain “show version” and “show running-config” (or equivalent) from the customer.
STEP 2:
As “icosftp” user (NCM FTP user), put the “show running-config” file under the FTP directory (refer to your FTP resource).
Eg. (show version)
ibm_oss@ibmtest123> show version Hostname: ibmtest123 Model: srx650 JUNOS Software Release [12.3X46-D25.7] |
Eg. (show running-config)
[icosftp@ncm ~]$ pwd /home/icosftp [icosftp@ncm ~]$ ls -l srx-config.txt -rw-rw-r-- 1 icosftp icosftp 78985 Sep 18 22:19 srx-config.txt [icosftp@ncm ~]$ head srx-config.txt <rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.3X46/junos"> <configuration junos:commit-seconds="1504957031" junos:commit-localtime="2017-09-09 21:37:11 EST" junos:commit-user="ibmtest"> <version>12.3X46-D25.7</version> <system> <host-name>ibmtest123</host-name> <time-zone>Australia/Melbourne</time-zone> <no-redirects/> <no-ping-record-route/> <no-ping-time-stamp/> <internet-options> [icosftp@ncm ~]$ |
STEP 3:
Create a new network resource.
Fill in the details based on the “show version” collected.
STEP 4:
Edit the RAD of the created resource.
Remove all default “Access Types”
Add a new “Access Type” (in this case, I named it “file”)
Set the “SSH Options” to the values shown below.
Set the “Command Line -> Script” to “file” (we will create the script later).
Set the “Configuration” as shown below.
Then, click Save and check on the “Access Types -> file” to make sure the settings are correct.
Now, let’s create the “file” script. We start by removing all default scripts.
Then, let’s add the new script called “file”.
This is the template for the “file based device” script. It means you can reuse it for other devices by changing:
- diag.01.setReturnBuff=Juniper|Router|SRX650|12.3X46-D25.7
- model.01.setReturnBuff=srx650
- config.version.setReturnBuff=12.3X46-D25.7
- config.running.05.readReturnFromFile=/home/icosftp/srx-config.txt (** Please point to the "show running-config" file you saved in Step #2 above)
- config.stored.05.readReturnFromFile=/home/icosftp/srx-config.txt (** Please point to the "show running-config" file you saved in Step #2 above)
#turn on flags to get info from file server getConfigFileServer=true getModelFileServer=true getDiagFileServer=true getVersionFileServer=true getBinaryFileServer=true putConfigFileServer=true
###Defaults for sending commands. Errors must be separated by, not spaces #default.prompt=$ #log-in.prompt=$ #default.error=Error,Invalid,Incomplete command #default.errorResponse=Error sending command log-in.prompt=& default.prompt=> default.error=Login incorrect,<xnm:error,Error,ERROR:,syntax error,<error>,error:,missing,check-out failed,value outside range,invalid ,not within range,statement has no contents; ignored default.errorResponse=Error sending command
###Connection Global #ifconnect.* is not present use connect.all.properties connect.errorResponse=Unable to connect to device connect.09.wait=>
#check for Running config and stored config values multiple Configs or Single Config config.check.end=singleConfig
#Signals start of config config.start=system
#Signals end of config config.end=>
#Identifies error retreiving config. Must be separated by, config.fail=Error,syntax error,<error>,error
#Info #these commands are used to gain some information on the hardware installed #in the device diag.01.setReturnBuff=Juniper|Router|SRX650|12.3X46-D25.7 diag.end=>
#Model ##using the command below, or similar, select the text that will allow determination of amodel #model.00.isJunoOs=false model.01.setReturnBuff=srx650 model.end=> model.FIND-BEGIN=c model.FIND-END=d
#Version ##using the command below,or similar, select the text that will allow determination of an OS version #config.version.00.isJunoOs=false config.version.setReturnBuff=12.3X46-D25.7 config.version.end=> config.version.FIND-BEGIN=a config.version.FIND-END=b #config.version.FEATURE-FIND-BEGIN=c #config.version.FEATURE-FIND-END=d
#Runningconfig ### ## The setFtpFileName parameter can be used to specify a single file if needed. ### #config.running.01.setFtpFileName=<filename> ### ##The address Name parameter will use the name of the resource. If you modify ##the directory structure on the source file server,then there is one edit to ##the device script required. The "f" parameter in the "cut" operation needs to ##be incremented to match the number of directory levels. If you add a level ##on the source file server, then "-f4" is changed to "-f5" and so on. ##The other change required is an addition of a corresponding directory tothe ##/home/icosftp directory to match the source directory. This is required due to ##the way the file-based access method uses the ftp resource. ### ##The end parameter, either first or last, specifies the first or last instance ##of the file based upon a file listing of "ls-r" reverse time. Changing this ##to "ls-l" would require the parameter to be changed to last to obtain the ##latest version of the file.The reverse time listing was used to reduce ##the number of results that would be examined.
#running-config #config.running.00.isJunoOs=true config.saveReturnBuff=true config.running.05.readReturnFromFile=/home/icosftp/srx-config.txt config.running.end=</rpc-reply> #config.running.FIND-BEGIN=# START #config.running.FIND-END=# END
#Stored config #config.running.00.isJunoOs=true config.stored.saveReturnBuff=true config.stored.05.readReturnFromFile=/home/icosftp/srx-config.txt config.stored.end=</rpc-reply> #config.stored.FIND-BEGIN=# START #config.stored.FIND-END=# END
###Sends a change back to the file server ftp.01.send=putSCP://$ftp_username$:$ftp_password$@$ftp_hostname$/$ftp_filename$running-config\r ftp.09.wait=</rpc-reply> ftp.end=</rpc-reply>
|
Save the configuration.
STEP 5:
Now, you can proceed perform “Import Configuration” (you can see that the new device only contains Blank Configuration).
Check the execution status of the UOW.
IMPORTANT: While you can perform simple tasks like “Import Configuration”, golden configuration, compliance, etc on the file based device, you cannot use IDT or OS Upgrade, etc.
UID
ibm11081629