Packaging and Publishing an Application

This chapter contains the following sections:

About Packaging and Publishing an Application

After developing your application, you must validate and package the application. You can package an application and upload the packaged application directly to APIC or distribute the app through Cisco ACI App Center.

Prerequisites

  • You have packager cisco_aci_app_packager-1.0.tar.gz file from Cisco DevNet. The packager file contains the packager aci-app-packager.py, validator aci_app_validator.py, and license Cisco_App_Center_License.txt files, required for packaging the app. The packager and validator files must be in the same directory. If the Cisco_App_Center_License.txt is not present, the app cannot be validated and will not be packaged.

  • You have the Python version 2.7.x with the following modules:

    • Pycrypto, version 2.6.1

    • Python-magic, version 0.4.12

    • Validators, version 0.10.3

  • For publishing the app to Cisco ACI App Center, you must have a developer account to access the Cisco ACI App Center.

    You have generated the keys for the application, to publish the app to Cisco ACI App Center. See Generating Keys for an Application.

Packaging an Application

Use this procedure to validate and package an application. You can package an application and upload the packaged application directly to APIC or distribute the app through Cisco ACI App Center.

Procedure


Step 1

Log in to your workspace.

Step 2

To install the packager file, enter the command pip install cisco_aci_app_packager-1.0.tar.gz .

Step 3

To extract the package, enter the command tar xvfz cisco_aci_app_packager-1.0.tar.gz

Step 4

Do one of the following:

  • To upload the package directly to APIC, enter the command python aci-app-packager.py -f path to the folder location of the app to be packaged to invoke the script.
  • To distribute the app through Cisco ACI App Center, enter the command python aci-app-packager.py -f path to the folder location of the app to be packaged -p path to the folder location of the private key downloaded from the Cisco ACI App Center to invoke the script.

The packager uses the validator to validate the directory structure of the app and the app metadata. If the validation is successful, the app is packaged. If the app cannot be validated, an error message is displayed. Ensure that the packager and validator files are present in the same directory.

The output of the packaged app is located in the app directory. The package name for the app is created using the meta data from the app.json file. This ensures that every package name is unique. The following format is used to create the package name:

vendordomain-appid-version.aci

Example:

Packing an app for uploading the package to APIC
python aci-app-packager.py -f /local/varbahara/danube/mgmt.git/appstore/apps/ContractViewer

Validation of mandatory files and directories successful
Retrieving app meta data successful
Validation of app meta data successful
App successfully packaged /local/varbahara/danube/mgmt.git/appstore/apps/Cisco-ContractViewer-1.0.aci


Packaging an app for distributing an app through the Cisco ACI App Center

python aci_app_packager.py -f /local/sunverma/ContractViewer -p /local/sunverma/my_private_key.pem
Validation of mandatory files and directories successful
Retrieving app meta data successful
Validation of app meta data successful
App successfully packaged - /local/sunverma/Cisco-ContractViewer-1.0.aci

Example for Packaging an Application

Example workflow for packaging an application

Install cisco_aci_app_packager
==============================

user@osboxes:~/app$ pip install cisco_aci_app_packager-1.0.tar.gz 
Processing ./cisco_aci_app_packager-1.0.tar.gz
Collecting flask (from cisco-aci-app-packager===1.0)
  Downloading Flask-0.11.1-py2.py3-none-any.whl (80kB)
    100% |████████████████████████████████| 81kB 1.9MB/s 
Collecting pycrypto (from cisco-aci-app-packager===1.0)
  Downloading pycrypto-2.6.1.tar.gz (446kB)
    100% |████████████████████████████████| 450kB 1.0MB/s 
Collecting validators (from cisco-aci-app-packager===1.0)
  Downloading validators-0.11.1.tar.gz
Collecting python-magic (from cisco-aci-app-packager===1.0)
  Downloading python-magic-0.4.12.tar.gz
Collecting click>=2.0 (from flask->cisco-aci-app-packager===1.0)
  Downloading click-6.6-py2.py3-none-any.whl (71kB)
    100% |████████████████████████████████| 71kB 4.3MB/s 
Collecting Werkzeug>=0.7 (from flask->cisco-aci-app-packager===1.0)
  Downloading Werkzeug-0.11.11-py2.py3-none-any.whl (306kB)
    100% |████████████████████████████████| 307kB 1.7MB/s 
Collecting Jinja2>=2.4 (from flask->cisco-aci-app-packager===1.0)
  Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
    100% |████████████████████████████████| 266kB 2.3MB/s 
Collecting itsdangerous>=0.21 (from flask->cisco-aci-app-packager===1.0)
  Downloading itsdangerous-0.24.tar.gz (46kB)
    100% |████████████████████████████████| 51kB 4.4MB/s 
Collecting six>=1.4.0 (from validators->cisco-aci-app-packager===1.0)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting decorator>=3.4.0 (from validators->cisco-aci-app-packager===1.0)
  Downloading decorator-4.0.10-py2.py3-none-any.whl
Collecting MarkupSafe (from Jinja2>=2.4->flask->cisco-aci-app-packager===1.0)
  Downloading MarkupSafe-0.23.tar.gz
Building wheels for collected packages: cisco-aci-app-packager, pycrypto, validators, python-magic, itsdangerous, MarkupSafe
  Running setup.py bdist_wheel for cisco-aci-app-packager ... done
  Stored in directory: /home/user/.cache/pip/wheels/56/ed/5d/4be7c57b82475f9c99e96c3dddbe45796456cee0a2d4280b8b
  Running setup.py bdist_wheel for pycrypto ... done
  Stored in directory: /home/user/.cache/pip/wheels/80/1f/94/f76e9746864f198eb0e304aeec319159fa41b082f61281ffce
  Running setup.py bdist_wheel for validators ... done
  Stored in directory: /home/user/.cache/pip/wheels/9a/ca/46/13ef93cd6d834fc0c2a144060ea0964fc0558932ae82b7241c
  Running setup.py bdist_wheel for python-magic ... done
  Stored in directory: /home/user/.cache/pip/wheels/f8/61/e5/dd1029e23a94a40b995eab1a9e06a1cf874c7745a383af5034
  Running setup.py bdist_wheel for itsdangerous ... done
  Stored in directory: /home/user/.cache/pip/wheels/fc/a8/66/24d655233c757e178d45dea2de22a04c6d92766abfb741129a
  Running setup.py bdist_wheel for MarkupSafe ... done
  Stored in directory: /home/user/.cache/pip/wheels/a3/fa/dc/0198eed9ad95489b8a4f45d14dd5d2aee3f8984e46862c5748
Successfully built cisco-aci-app-packager pycrypto validators python-magic itsdangerous MarkupSafe
Installing collected packages: click, Werkzeug, MarkupSafe, Jinja2, itsdangerous, flask, pycrypto, six, decorator, validators, python-magic, cisco-aci-app-packager
Successfully installed Jinja2 MarkupSafe Werkzeug cisco-aci-app-packager click decorator flask itsdangerous pycrypto python-magic six validators
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.


Validate installation
=====================

user@osboxes:~/app$ python
Python 2.7.12+ (default, Sep 17 2016, 12:08:02) 
[GCC 6.2.0 20160914] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Crypto
>>> import magic
>>> import validators
>>> import flask
>>> 

Extract the package
===================

user@osboxes:~/app$ tar xvfz cisco_aci_app_packager-1.0.tar.gz 
cisco_aci_app_packager-1.0/
cisco_aci_app_packager-1.0/setup.py
cisco_aci_app_packager-1.0/packager/
cisco_aci_app_packager-1.0/packager/__init__.py
cisco_aci_app_packager-1.0/packager/aci_app_packager.py
cisco_aci_app_packager-1.0/packager/aci_app_validator.py
cisco_aci_app_packager-1.0/packager/Cisco_App_Center_Customer_Agreement.docx
cisco_aci_app_packager-1.0/packager/Cisco_App_Center_License.txt
cisco_aci_app_packager-1.0/packager/Cisco_App_Center_Export_Compliance_Questionnaire.docx
cisco_aci_app_packager-1.0/setup.cfg
cisco_aci_app_packager-1.0/PKG-INFO
cisco_aci_app_packager-1.0/cisco_aci_app_packager.egg-info/
cisco_aci_app_packager-1.0/cisco_aci_app_packager.egg-info/top_level.txt
cisco_aci_app_packager-1.0/cisco_aci_app_packager.egg-info/requires.txt
cisco_aci_app_packager-1.0/cisco_aci_app_packager.egg-info/PKG-INFO
cisco_aci_app_packager-1.0/cisco_aci_app_packager.egg-info/dependency_links.txt
cisco_aci_app_packager-1.0/cisco_aci_app_packager.egg-info/not-zip-safe
cisco_aci_app_packager-1.0/cisco_aci_app_packager.egg-info/SOURCES.txt
cisco_aci_app_packager-1.0/README.rst

Go to packager directory
=======================

user@osboxes:~/app$ cd cisco_aci_app_packager-1.0/packager/


Use package command to package your app
=======================================

Without developer signature:

user@osboxes:~/app/cisco_aci_app_packager-1.0/packager$ python aci_app_packager.py -f /home/user/app/VisuDash
Validation of mandatory files and directories successful
Retrieving app meta data successful
Validation of app meta data successful
App successfully packaged - /home/user/app/Cisco-VisuDash-1.0.aci

With developer signature:

user@osboxes:~/app/cisco_aci_app_packager-1.0/packager$ python aci_app_packager.py -f /home/user/app/VisuDash -p /home/user/app/aci_app_qa_private_key.pem
Validation of mandatory files and directories successful
Retrieving app meta data successful
Validation of app meta data successful
App successfully packaged - /home/user/app/Cisco-VisuDash-1.0.aci

Cisco ACI App Center

Generating Keys for an Application

Use this procedure to generate developer signature or private keys for the application. The signature is required for packaging the app before publishing the app to the Cisco ACI App Center.

Before you begin

  • You have a developer account to access the Cisco ACI App Center.

Procedure


Step 1

Log in to Cisco ACI App Center.

Step 2

Choose My Account > Developer Signature.

Step 3

Click Request New Key to generate the keys.

Once you generate the keys you can use the keys to package the app and then publish the app to Cisco ACI App Center.


Publishing an Application

Use this procedure to upload and publish the application to Cisco ACI App Center. After you publish the app to the Cisco ACI App Center, the app is validated, approved, and certified by Cisco ACI App Center. Once the app is certified, users can download and install the app to APIC.

Before you begin

  • You have a developer account to access the Cisco ACI App Center.

  • You have signed and packaged the application. See Packaging an Application.

Procedure


Step 1

Log in to Cisco ACI App Center.

Note 

You must have a developer account to access the Cisco ACI App Center.

Step 2

Choose Developer Dashboard.

The Developer Dashboard is displayed

Step 3

Click Publish a new app.

Step 4

Click Upload to upload the app signed and packaged by the developer to the Cisco ACI App Center.

The uploaded app is then displayed in the Dashboard. The app is then validated and sent for approval. Once the app is approved, it is certified by Cisco ACI App Center and available for downloading.


Downloading Application From Cisco ACI App Center

Use this procedure to download an approved application from the Cisco ACI App Center.

Procedure


Step 1

Log in to Cisco ACI App Center as an end user.

Step 2

Click Browse Apps.

The list of apps available for download are displayed. You can click the list icon to display the available apps in the list view or you can click the grid icon to display the available apps in a grid view.

Step 3

Select an app to view the details.

Step 4

Click Download. Review the license agreement and click Agree and Download.

The app is downloaded to your local machine.


Cisco APIC, Release 2.x

Enabling Signature Validation for an Application

All apps published to Cisco ACI App Center are signed by Cisco. An admin user can choose to enable signature validation for all the apps on the APIC. Once you enable signature validation, only the apps signed by Cisco can be installed on the APIC. By default, signature validation for an app is disabled.

Procedure


Enable signature validation for an app, using the following REST API POST:

Example:

https://<APIC IP>/api/plgnhandler/mo/.xml:
<apPluginPolContr>
    <apPluginPol verifySignature="enable"/>
</apPluginPolContr>

Uploading an Application to APIC

Use this procedure to upload your packaged application to APIC,for APIC Release 2.x. Only an APIC admin user can upload and install an application.

Before you begin

  • You have developed your application.

  • You have packaged your application.

Procedure


Step 1

Log in to the Cisco APIC.

Step 2

On the menu bar, choose Apps > All Apps.

Step 3

Click the + icon to add an app.

Step 4

Click Browse to upload the app.

Step 5

Click Submit to upload the app.

After the app is uploaded, the thumbnail of the uploaded app is displayed under the All Apps tab.


Installing an Application

Use this procedure to install your application to APIC, for APIC Release 2.x. Only an APIC admin user can upload and install an application.

Before you begin

  • You have developed the application.

  • You have packaged the application.

  • You have uploaded the application to APIC.

Procedure


Step 1

Log in to Cisco APIC.

Step 2

On the menu bar, choose Apps > All Apps.

Step 3

Select the app and verify the User Name, User Role, Permissions for the app. Specify the Security Domain for the app.

See Understanding Permissions for an Application for more information.

Step 4

Click Install to install the app. You can also select Install from the Actions drop-down list to install an app.

Once the app is installed, it is displayed on the Installed Apps tab.

Step 5

To launch an app, select the app from the Installed Apps tab. In the app.json file, if an Insertion URL is specified, then the app is also inserted in the APIC UI in the location as specified in the insertion URL. You can then launch the app from location where the app is inserted in the APIC UI.


Cisco APIC, Release 3.x

Enabling Signature Validation for an Application for APIC Release 3.x

All apps published to Cisco ACI App Center are signed by Cisco. An admin user can choose to enable signature validation for all the apps on the APIC. Once you enable signature validation, only the apps signed by Cisco can be installed on the APIC. By default, signature validation for an app is disabled.

Procedure


Step 1

Log in to Cisco APIC.

Step 2

On the menu bar, choose Apps > Apps.

Step 3

From the Settings menu, check the Enable Signature check box.


Uploading an Application to APIC for APIC Release 3.x

Use this procedure to upload your packaged application to APIC, for APIC Release 3.x. Only an APIC admin user can upload and install an application.

Before you begin

  • You have developed your application.

  • You have packaged your application.

Procedure


Step 1

Log in to the Cisco APIC.

Step 2

On the menu bar, choose Apps > Apps.

Step 3

Click the Upload Application icon to add an app.

Step 4

Click Browse to upload the app.

Step 5

Click Submit to upload the app.

After the app is uploaded, the thumbnail of the uploaded app is displayed under the Apps tab.


Installing an Application for APIC Release 3.x

Use this procedure to install your application to APIC, for APIC Release 3.x. Only an APIC admin user can upload and install an application.

Before you begin

  • You have developed the application.

  • You have packaged the application.

  • You have uploaded the application to APIC.

Procedure


Step 1

Log in to Cisco APIC.

Step 2

On the menu bar, choose Apps > Apps.

Step 3

Do one of the following.

  • In the graphic view, select an application and click Enable.
  • In the table view, select an application and from the Settings menu click Enable Application .
Step 4

Verify the User Name, User Role, Permissions for the app. Specify the Security Domain for the app.

See Understanding Permissions for an Application for more information.

Step 5

Click Enable.

Step 6

To launch an app, select the app and click Open. In the app.json file, if an Insertion URL is specified, then the app is also inserted in the APIC UI in the location as specified in the insertion URL. You can then launch the app from location where the app is inserted in the APIC UI.

Step 7

To maximize the app's window, click the icon. To restore the app's window click the icon.