napalm-automation / napalm-junos

Apache License 2.0
22 stars 42 forks source link

SRX get_facts() enhancement: clustering #190

Closed sincerywaing closed 7 years ago

sincerywaing commented 7 years ago

Description of Issue/Question

Can we add clustering information to srx get_facts()? show chassis cluster summary

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

[* ] Yes [ ] No

Setup

napalm-junos version

(Paste verbatim output from pip freeze | grep napalm-junos between quotes below)

0.11.0

JunOS version

(Paste verbatim output from show version and haiku between quotes below)

srx firewall

Steps to Reproduce the Issue

N/A

Error Traceback

(Paste the complete traceback of the exception between quotes below)

N/A
sincerywaing commented 7 years ago

actually underjnpr.junos.facts there are srx_cluster, srx_cluster_id and srx_cluster_redundancy_group.

dbarrosop commented 7 years ago

This is probably something that is better to have somewhere else as the use is quite niche. Either we find a good fit in the current openconfig/ietf models or we create our own.

@bewing, do you think the platform model could be a good fit for something like this?

bewing commented 7 years ago

It could definitely work -- there could be a virtual component that captured the status of the cluster in its properties, and the individual firewalls could also include cluster status information in their properties.

https://github.com/openconfig/public/blob/master/release/models/platform/openconfig-platform.yang#L57

Property definition was left intentionally vague in order to allow capture of vendor-specific technologies. Not sure if we want to spend effort to try to come up with a standard for virtual chassis (VSS, stacking, et al) or just format each vendor's status ouputs freeform.

dbarrosop commented 7 years ago

format each vendor's status ouputs freeform

I'd personally do that. These are propietary technologies anyway.

sincerywaing commented 7 years ago

We can use a universal way to define a 'get_vc_status' in napalm-base and implement it in various vendor specifics. quite useful function.

dbarrosop commented 7 years ago

@sincerywaing do you have an example of the RPC command and response needed to extract that information?

sincerywaing commented 7 years ago

@dbarrosop

srx:


show chassis cluster summary

<rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.3X48/junos">
    <chassis-cluster-status>
        <cluster-id>1</cluster-id>
        <redundancy-group>
            <cluster-id>1</cluster-id>
            <redundancy-group-id>0</redundancy-group-id>
            <redundancy-group-failover-count>1</redundancy-group-failover-count>
            <device-stats>
                <device-name>node0</device-name>
                <device-priority>254</device-priority>
                <redundancy-group-status>primary</redundancy-group-status>
                <preempt>no</preempt>
                <failover-mode>no</failover-mode>
                <monitor-failures>None</monitor-failures>
                <device-name>node1</device-name>
                <device-priority>1</device-priority>
                <redundancy-group-status>secondary</redundancy-group-status>
                <preempt>no</preempt>
                <failover-mode>no</failover-mode>
                <monitor-failures>None</monitor-failures>
            </device-stats>
        </redundancy-group>
        <redundancy-group>
            <cluster-id>1</cluster-id>
            <redundancy-group-id>1</redundancy-group-id>
            <redundancy-group-failover-count>1</redundancy-group-failover-count>
            <device-stats>
                <device-name>node0</device-name>
                <device-priority>254</device-priority>
                <redundancy-group-status>primary</redundancy-group-status>
                <preempt>no</preempt>
                <failover-mode>no</failover-mode>
                <monitor-failures>None</monitor-failures>
                <device-name>node1</device-name>
                <device-priority>1</device-priority>
                <redundancy-group-status>secondary</redundancy-group-status>
                <preempt>no</preempt>
                <failover-mode>no</failover-mode>
                <monitor-failures>None</monitor-failures>
            </device-stats>
        </redundancy-group>
    </chassis-cluster-status>
    <cli>
        <banner>{primary:node0}</banner>
    </cli>
</rpc-reply>

ex3300:

show virtual-chassis status

<rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.3R5/junos">
    <virtual-chassis-information>
        <preprovisioned-virtual-chassis-information>
            <virtual-chassis-id>aaaa.bbbb.cccc</virtual-chassis-id>
            <virtual-chassis-mode>Enabled</virtual-chassis-mode>
        </preprovisioned-virtual-chassis-information>
        <member-list junos:style="single-slot">
            <member>
                <member-status>Prsnt</member-status>
                <member-id>0</member-id>
                <fpc-slot>(FPC 0)</fpc-slot>
                <member-serial-number>RS34241112</member-serial-number>
                <member-model>ex3300-48p</member-model>
                <member-priority>129</member-priority>
                <member-mixed-mode>NA</member-mixed-mode>
                <member-role>Backup</member-role>
                <neighbor-list>
                    <neighbor>
                        <neighbor-id>1</neighbor-id>
                        <neighbor-interface>vcp-255/1/2</neighbor-interface>
                    </neighbor>
                    <neighbor>
                        <neighbor-id>4</neighbor-id>
                        <neighbor-interface>vcp-255/1/3</neighbor-interface>
                    </neighbor>
                </neighbor-list>
            </member>
            <member>
                <member-status>Prsnt</member-status>
                <member-id>1</member-id>
                <fpc-slot>(FPC 1)</fpc-slot>
                <member-serial-number>RS342413231</member-serial-number>
                <member-model>ex3300-48p</member-model>
                <member-priority>129</member-priority>
                <member-mixed-mode>NA</member-mixed-mode>
                <member-role>Master*</member-role>
                <neighbor-list>
                    <neighbor>
                        <neighbor-id>2</neighbor-id>
                        <neighbor-interface>vcp-255/1/2</neighbor-interface>
                    </neighbor>
                    <neighbor>
                        <neighbor-id>0</neighbor-id>
                        <neighbor-interface>vcp-255/1/3</neighbor-interface>
                    </neighbor>
                </neighbor-list>
            </member>
            <member>
                <member-status>Prsnt</member-status>
                <member-id>2</member-id>
                <fpc-slot>(FPC 2)</fpc-slot>
                <member-serial-number>RS3424133212</member-serial-number>
                <member-model>ex3300-48p</member-model>
                <member-priority>0</member-priority>
                <member-mixed-mode>NA</member-mixed-mode>
                <member-role>Linecard</member-role>
                <neighbor-list>
                    <neighbor>
                        <neighbor-id>3</neighbor-id>
                        <neighbor-interface>vcp-255/1/2</neighbor-interface>
                    </neighbor>
                    <neighbor>
                        <neighbor-id>1</neighbor-id>
                        <neighbor-interface>vcp-255/1/3</neighbor-interface>
                    </neighbor>
                </neighbor-list>
            </member>
            <member>
                <member-status>Prsnt</member-status>
                <member-id>3</member-id>
                <fpc-slot>(FPC 3)</fpc-slot>
                <member-serial-number>RS342416676</member-serial-number>
                <member-model>ex3300-48p</member-model>
                <member-priority>0</member-priority>
                <member-mixed-mode>NA</member-mixed-mode>
                <member-role>Linecard</member-role>
                <neighbor-list>
                    <neighbor>
                        <neighbor-id>5</neighbor-id>
                        <neighbor-interface>vcp-255/1/2</neighbor-interface>
                    </neighbor>
                    <neighbor>
                        <neighbor-id>2</neighbor-id>
                        <neighbor-interface>vcp-255/1/3</neighbor-interface>
                    </neighbor>
                </neighbor-list>
            </member>
            <member>
                <member-status>Prsnt</member-status>
                <member-id>4</member-id>
                <fpc-slot>(FPC 4)</fpc-slot>
                <member-serial-number>RS34241976</member-serial-number>
                <member-model>ex3300-48p</member-model>
                <member-priority>0</member-priority>
                <member-mixed-mode>NA</member-mixed-mode>
                <member-role>Linecard</member-role>
                <neighbor-list>
                    <neighbor>
                        <neighbor-id>5</neighbor-id>
                        <neighbor-interface>vcp-255/1/2</neighbor-interface>
                    </neighbor>
                    <neighbor>
                        <neighbor-id>0</neighbor-id>
                        <neighbor-interface>vcp-255/1/3</neighbor-interface>
                    </neighbor>
                </neighbor-list>
            </member>
            <member>
                <member-status>Prsnt</member-status>
                <member-id>5</member-id>
                <fpc-slot>(FPC 5)</fpc-slot>
                <member-serial-number>RS342419087</member-serial-number>
                <member-model>ex3300-48p</member-model>
                <member-priority>0</member-priority>
                <member-mixed-mode>NA</member-mixed-mode>
                <member-role>Linecard</member-role>
                <neighbor-list>
                    <neighbor>
                        <neighbor-id>4</neighbor-id>
                        <neighbor-interface>vcp-255/1/2</neighbor-interface>
                    </neighbor>
                    <neighbor>
                        <neighbor-id>3</neighbor-id>
                        <neighbor-interface>vcp-255/1/3</neighbor-interface>
                    </neighbor>
                </neighbor-list>
            </member>
        </member-list>
    </virtual-chassis-information>
    <cli>
        <banner>{master:1}</banner>
    </cli>
</rpc-reply>
dbarrosop commented 7 years ago

What's the RPC command? You can see it with show whatever | display xml rpc or something like that. Will look into adding support for this with napalm-yang in a couple of weeks.

sincerywaing commented 7 years ago
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.3X48/junos">
    <rpc>
        <get-chassis-cluster-status>
        </get-chassis-cluster-status>
    </rpc>
    <cli>
        <banner>{primary:node0}</banner>
    </cli>
</rpc-reply>
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.3R5/junos">
    <rpc>
        <get-virtual-chassis-information>
        </get-virtual-chassis-information>
    </rpc>
    <cli>
        <banner>{master:1}</banner>
    </cli>
</rpc-reply>
mirceaulinic commented 7 years ago

Hi @sincerywaing - I am afraid i need to close this, as we no longer accept PRs and issues to this repository. After the reunification (see https://napalm-automation.net/reunification/) you can submit a PR or discuss this further under the main repo (https://github.com/napalm-automation/napalm). For the time being, I moved this issue to https://github.com/napalm-automation/napalm/issues/432. Thanks for understanding!