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

NSO Workflow

previousqna
Level 5
Level 5

Hello Team,

I have a customer that they have a workflow process to configure some Interfaces with HSRP feature in a couple of routers. According to their process, Engineer Team is responsible to produce all router configuration and send them via .DOC file to the Assurance team that is responsible to apply that config in the routers during the maintenance window.

I have spoken with them to use Cisco NSO to deploy this kind of service however they asked me if it is possible to generate all configuration in the NSO but just save it, and then Assurance Team only apply the config. Would be possible to create this workflow process in the NSO? For sure that this way will help them a lot with time and configuration mistakes.

1 Accepted Solution

Accepted Solutions

NCS CLI can be used to generate preview of these configs as well. API provides an ability to extract the same preview output that would be obtained from CLI. From Config mode of NCS CLI,

 

 

 

To create/modify services — set services <$serviceName> <$KeyParam1Val> <$dyanamicParam2> <$dyanamicParam2Val>  …….

 

 

 

    Commit dry-run out format native

 

 

 

To delete  services — delete services <$serviceName> <$KeyParam1Val>

 

 

 

       Commit dry-run out format native

 

 

 

 

 

Example for using the NCS RequestActionTh API for accomplishing the same preview as above:

 

 

 

/**

 

     * Execute NCS Commit Dry run Action

 

     *

 

     * @param params

 

     *            - an array of ConfXMLParam, parameters for completing the

 

     *            action

 

     * @param output

 

     *            - A list of ConfXMLParam, parameters for output

 

     * @param maapi

 

     *            -- Maapi, session object

 

     * @param th

 

     *            -- int, session index

 

     * @param reviewErrIndexNum

 

     *            -- String, Error index Number

 

     * @param reviewErrMsg

 

     *            -- String, Error index Message

 

     * @param service

 

     *            -- String, Service Name

 

     * @throws ConfException

 

     * @throws IOException

 

     *

 

     */

 

    private void executeNCSCommitDryRun(ConfXMLParam[] params,

 

            List<ConfXMLParam> output, Maapi maapi, int th,

 

            String reviewErrIndexNum, String reviewErrMsg, String service)

 

                    throws ConfException, IOException {

 

        ConfNamespace ncsNS = null;

 

        ConfXMLParam[] diffNative = null;

 

        ConfXMLParam[] diff = null;

 

        String previewDiffSetValue = null;

 

 

 

        ncsNS = new Ncs();

 

        diffNative = new ConfXMLParam[]{new ConfXMLParamValue(ncsNS.hash(),

 

                Ncs._outformat, new ConfEnumeration(2))};

 

        diff = maapi.requestActionTh(th, diffNative, "/services/commit-dry-run");

 

 

 

        previewDiffSetValue = generatePreviewDiffSetValue(ConfXMLParam

 

                .toXML(diff)) != null

 

                ? generatePreviewDiffSetValue(ConfXMLParam.toXML(diff))

 

                        : "";

 

 

 

                LOGGER.info("Extracted Preview Value: " + previewDiffSetValue);

 

 

 

                EnterpriseOnboardUtility.setErrorReturn(output,

 

                        Integer.parseInt(reviewErrIndexNum), reviewErrMsg,

 

                        previewDiffSetValue);

View solution in original post

3 Replies 3

previousqna
Level 5
Level 5

Yes, it is possible to just generate the configuration intended for services to be deployed without actually applying them on the routers. We can leverage the commit–dry run feature through an API invocation to generate the native configs. 

 

 

 

            maapi.requestActionTh(th, diffNative, "/services/commit-dry-run);

 

 

 

It may be possible to save the generated configs and then have an external workflow process to either retrieve it at a later time for review or if found acceptable by the operators then provide an option (with Approvals) for those configs to be applied on the device.

Is there any way using NCS CLI? Or only via any kind of API?

 

Also, could you show me how to use this example that you sent.

NCS CLI can be used to generate preview of these configs as well. API provides an ability to extract the same preview output that would be obtained from CLI. From Config mode of NCS CLI,

 

 

 

To create/modify services — set services <$serviceName> <$KeyParam1Val> <$dyanamicParam2> <$dyanamicParam2Val>  …….

 

 

 

    Commit dry-run out format native

 

 

 

To delete  services — delete services <$serviceName> <$KeyParam1Val>

 

 

 

       Commit dry-run out format native

 

 

 

 

 

Example for using the NCS RequestActionTh API for accomplishing the same preview as above:

 

 

 

/**

 

     * Execute NCS Commit Dry run Action

 

     *

 

     * @param params

 

     *            - an array of ConfXMLParam, parameters for completing the

 

     *            action

 

     * @param output

 

     *            - A list of ConfXMLParam, parameters for output

 

     * @param maapi

 

     *            -- Maapi, session object

 

     * @param th

 

     *            -- int, session index

 

     * @param reviewErrIndexNum

 

     *            -- String, Error index Number

 

     * @param reviewErrMsg

 

     *            -- String, Error index Message

 

     * @param service

 

     *            -- String, Service Name

 

     * @throws ConfException

 

     * @throws IOException

 

     *

 

     */

 

    private void executeNCSCommitDryRun(ConfXMLParam[] params,

 

            List<ConfXMLParam> output, Maapi maapi, int th,

 

            String reviewErrIndexNum, String reviewErrMsg, String service)

 

                    throws ConfException, IOException {

 

        ConfNamespace ncsNS = null;

 

        ConfXMLParam[] diffNative = null;

 

        ConfXMLParam[] diff = null;

 

        String previewDiffSetValue = null;

 

 

 

        ncsNS = new Ncs();

 

        diffNative = new ConfXMLParam[]{new ConfXMLParamValue(ncsNS.hash(),

 

                Ncs._outformat, new ConfEnumeration(2))};

 

        diff = maapi.requestActionTh(th, diffNative, "/services/commit-dry-run");

 

 

 

        previewDiffSetValue = generatePreviewDiffSetValue(ConfXMLParam

 

                .toXML(diff)) != null

 

                ? generatePreviewDiffSetValue(ConfXMLParam.toXML(diff))

 

                        : "";

 

 

 

                LOGGER.info("Extracted Preview Value: " + previewDiffSetValue);

 

 

 

                EnterpriseOnboardUtility.setErrorReturn(output,

 

                        Integer.parseInt(reviewErrIndexNum), reviewErrMsg,

 

                        previewDiffSetValue);

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: