cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
788
Views
0
Helpful
3
Replies

Deploying my own service package with nct - file name error

rslaski
Spotlight
Spotlight

Guys,

I'd like to use nct to deploy my service package, so I tar gzipped it, and tried with nct, but all I get is an 'Invalid package filename' error:

 

nct packages -c fetch --file ./services/TMPL-1.0-rsl-1.0.tar.gz 
Fetch Package at 10.133.100.3 [nso1]
(Exit Code 8) Error: Invalid package filename

stop on error: request software packages fetch package-from-file /tmp/TMPL-1.0-rsl-1.0.tar.gz

Fetch Package at 10.133.100.5 [nso2]
(Exit Code 8) Error: Invalid package filename

stop on error: request software packages fetch package-from-file /tmp/TMPL-1.0-rsl-1.0.tar.gz

 

 

I guess the nct validates the file name vs its contents, but can't find any documentation nor examples on how to handle service packages with nct. Any help would be appreciated.

 

thanks,
robert

1 Accepted Solution

Accepted Solutions

lmanor
Cisco Employee
Cisco Employee

Hello,

From a NCS environment shell use 'man' to get info on nct:

$ man nct

(various other nct-* man pages at bottom)

 

Specifically to your question - your package needs to comply with this format:

 

ADDING NEDS AND PACKAGES
When NCS is installed and is up and running, it is time to add
NEDs/packages to the systems. The name of a package is defined as:

ncs-<NCSVSN>-<PACKAGE><VSN>.tar.gz

Where NCSVSN is the major version of NCS used to build the package,
PACKAGE is the name of the package and VSN the version of the package.

 

Additionally the <PACKAGE> and <VSN> used in the filename must be consistent with what is in the package-meta-data.xml file.

 

Example:

[CentOS7-3 packages]cat MyPackage/package-meta-data.xml

<ncs-package xmlns="http://tail-f.com/ns/ncs-packages">

  <name>MyPackage</name>

  <package-version>1.0</package-version>

  <description>Generated Python package</description>

  <ncs-min-version>4.7</ncs-min-version>

 

  <component>

    <name>mypackage</name>

    <application>

      <python-class-name>MyPackage.mypackage.Service</python-class-name>

    </application>

  </component>

</ncs-package>

 

File format bad:

[CentOS7-3 ncs]$ sudo cp ncs-4.7.3-MyPackage-1.0.tar.gz MyPackage-1.0.tar.gz

[CentOS7-3 ncs]$ nct packages --verbose --hostsfile hostsfile -c fetch --file /var/opt/ncs/MyPackage-1.0.tar.gz

nct_lib(888): HTTP Request = "http://192.168.56.101:8080/api/running/software/packages/_operations/fetch"

nct_lib(902): HTTP(400) Reply = {"HTTP/1.1",400,"Bad Request"}

Fetch Package at 192.168.56.101:"8080" [CentOS7-3]

  ERROR : operation-failed - Invalid package filename

 

<PACKAGE> does not match meta-data:

[CentOS7-3 ncs]$ sudo mv ncs-4.7.3-MyPackage-1.0.tar.gz ncs-4.7.3-myPackage-1.0.tar.gz

[CentOS7-3 ncs]$ nct packages --verbose --hostsfile hostsfile -c fetch --file /var/opt/ncs/ncs-4.7.3-myPackage-1.0.tar.gz

nct_lib(888): HTTP Request = "http://192.168.56.101:8080/api/running/software/packages/_operations/fetch"

nct_lib(902): HTTP(400) Reply = {"HTTP/1.1",400,"Bad Request"}

Fetch Package at 192.168.56.101:"8080" [CentOS7-3]

  ERROR : operation-failed - Package name does not match contents

 

<VSN> does not match meta-data:

[CentOS7-3 ncs]$ nct packages --verbose --hostsfile hostsfile -c fetch --file /var/opt/ncs/ncs-4.7.3-MyPackage-2.0.tar.gz

nct_lib(888): HTTP Request = "http://192.168.56.101:8080/api/running/software/packages/_operations/fetch"

nct_lib(902): HTTP(400) Reply = {"HTTP/1.1",400,"Bad Request"}

Fetch Package at 192.168.56.101:"8080" [CentOS7-3]

  ERROR : operation-failed - Package version does not match contents

 

Successful package 'fetch' moves file into /opt/ncs/packages:

nct packages --verbose --hostsfile hostsfile -c fetch --file /var/opt/ncs/ncs-4.7.3-MyPackage-1.0.tar.gz

nct_lib(888): HTTP Request = "http://192.168.56.101:8080/api/running/software/packages/_operations/fetch"

nct_lib(896): HTTP(204) Reply = {"HTTP/1.1",204,"No Content"}

Fetch Package at 192.168.56.101:"8080" [CentOS7-3]

  OK

 

[CentOS7-3 ncs]$ nct packages --verbose --hostsfile hostsfile | grep My

  ncs-4.7.3-MyPackage-1.0 (installable)

 

Package install adds symbolic link in /var/opt/ncs/packages (run-time directory)

[CentOS7-3 ncs]$ nct packages --verbose --hostsfile hostsfile -c install --package ncs-4.7.3-MyPackage-1.0.tar.gz

nct_lib(888): HTTP Request = "http://192.168.56.101:8080/api/running/software/packages/_operations/install"

nct_lib(902): HTTP(200) Reply = {"HTTP/1.1",200,"OK"}

Install Package at 192.168.56.101:"8080" [CentOS7-3]

  OK

 

[CentOS7-3 ncs]$ nct packages --verbose --hostsfile hostsfile | grep My

  ncs-4.7.3-MyPackage-1.0 (installed)

 

Package is now installed and ready to be loaded into NSO with reload command.

 

 

View solution in original post

3 Replies 3

lmanor
Cisco Employee
Cisco Employee

Hello,

From a NCS environment shell use 'man' to get info on nct:

$ man nct

(various other nct-* man pages at bottom)

 

Specifically to your question - your package needs to comply with this format:

 

ADDING NEDS AND PACKAGES
When NCS is installed and is up and running, it is time to add
NEDs/packages to the systems. The name of a package is defined as:

ncs-<NCSVSN>-<PACKAGE><VSN>.tar.gz

Where NCSVSN is the major version of NCS used to build the package,
PACKAGE is the name of the package and VSN the version of the package.

 

Additionally the <PACKAGE> and <VSN> used in the filename must be consistent with what is in the package-meta-data.xml file.

 

Example:

[CentOS7-3 packages]cat MyPackage/package-meta-data.xml

<ncs-package xmlns="http://tail-f.com/ns/ncs-packages">

  <name>MyPackage</name>

  <package-version>1.0</package-version>

  <description>Generated Python package</description>

  <ncs-min-version>4.7</ncs-min-version>

 

  <component>

    <name>mypackage</name>

    <application>

      <python-class-name>MyPackage.mypackage.Service</python-class-name>

    </application>

  </component>

</ncs-package>

 

File format bad:

[CentOS7-3 ncs]$ sudo cp ncs-4.7.3-MyPackage-1.0.tar.gz MyPackage-1.0.tar.gz

[CentOS7-3 ncs]$ nct packages --verbose --hostsfile hostsfile -c fetch --file /var/opt/ncs/MyPackage-1.0.tar.gz

nct_lib(888): HTTP Request = "http://192.168.56.101:8080/api/running/software/packages/_operations/fetch"

nct_lib(902): HTTP(400) Reply = {"HTTP/1.1",400,"Bad Request"}

Fetch Package at 192.168.56.101:"8080" [CentOS7-3]

  ERROR : operation-failed - Invalid package filename

 

<PACKAGE> does not match meta-data:

[CentOS7-3 ncs]$ sudo mv ncs-4.7.3-MyPackage-1.0.tar.gz ncs-4.7.3-myPackage-1.0.tar.gz

[CentOS7-3 ncs]$ nct packages --verbose --hostsfile hostsfile -c fetch --file /var/opt/ncs/ncs-4.7.3-myPackage-1.0.tar.gz

nct_lib(888): HTTP Request = "http://192.168.56.101:8080/api/running/software/packages/_operations/fetch"

nct_lib(902): HTTP(400) Reply = {"HTTP/1.1",400,"Bad Request"}

Fetch Package at 192.168.56.101:"8080" [CentOS7-3]

  ERROR : operation-failed - Package name does not match contents

 

<VSN> does not match meta-data:

[CentOS7-3 ncs]$ nct packages --verbose --hostsfile hostsfile -c fetch --file /var/opt/ncs/ncs-4.7.3-MyPackage-2.0.tar.gz

nct_lib(888): HTTP Request = "http://192.168.56.101:8080/api/running/software/packages/_operations/fetch"

nct_lib(902): HTTP(400) Reply = {"HTTP/1.1",400,"Bad Request"}

Fetch Package at 192.168.56.101:"8080" [CentOS7-3]

  ERROR : operation-failed - Package version does not match contents

 

Successful package 'fetch' moves file into /opt/ncs/packages:

nct packages --verbose --hostsfile hostsfile -c fetch --file /var/opt/ncs/ncs-4.7.3-MyPackage-1.0.tar.gz

nct_lib(888): HTTP Request = "http://192.168.56.101:8080/api/running/software/packages/_operations/fetch"

nct_lib(896): HTTP(204) Reply = {"HTTP/1.1",204,"No Content"}

Fetch Package at 192.168.56.101:"8080" [CentOS7-3]

  OK

 

[CentOS7-3 ncs]$ nct packages --verbose --hostsfile hostsfile | grep My

  ncs-4.7.3-MyPackage-1.0 (installable)

 

Package install adds symbolic link in /var/opt/ncs/packages (run-time directory)

[CentOS7-3 ncs]$ nct packages --verbose --hostsfile hostsfile -c install --package ncs-4.7.3-MyPackage-1.0.tar.gz

nct_lib(888): HTTP Request = "http://192.168.56.101:8080/api/running/software/packages/_operations/install"

nct_lib(902): HTTP(200) Reply = {"HTTP/1.1",200,"OK"}

Install Package at 192.168.56.101:"8080" [CentOS7-3]

  OK

 

[CentOS7-3 ncs]$ nct packages --verbose --hostsfile hostsfile | grep My

  ncs-4.7.3-MyPackage-1.0 (installed)

 

Package is now installed and ready to be loaded into NSO with reload command.

 

 

Imanor,

 

Thanks for pointing this out! In fact, I was looking at the 'man nct-packages' page, where no such an information can be found, and I missed the paragraph in a common 'man nct'.

For all interested: when working with HA, it needs to be disabled before activating the package, and re-enabled back after. So the final sequence would be:

[rslaski@nso1 services]$ cat ./deploy_tmpl 
#!/bin/bash
NCSVSN=5.2.0.3
VSN=1.0
echo "### (1) creating archive"
tar zcf ./ncs-$NCSVSN-TMPL-$VSN.tar.gz ./TMPL

echo "### (2) running NSO backup"
nct backup

echo "### (3) distributing package"
nct packages -c fetch --file ./ncs-$NCSVSN-TMPL-$VSN.tar.gz  packages

echo "### (4) installing package"
nct packages -c install --package ncs-$NCSVSN-TMPL-$VSN --replace-existing

echo "### (5) activating package"
nct ha -a deactivate  
nct packages -c reload
nct ha -a activate  

echo "### finished"
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: