@@ -572,6 +572,164 @@ def getOrgOtherDeviceStats(
572572 return resp
573573
574574
575+ def countOrgSwOrGwPorts (
576+ mist_session : _APISession ,
577+ org_id : str ,
578+ distinct : str = "mac" ,
579+ full_duplex : bool | None = None ,
580+ mac : str | None = None ,
581+ neighbor_mac : str | None = None ,
582+ neighbor_port_desc : str | None = None ,
583+ neighbor_system_name : str | None = None ,
584+ poe_disabled : bool | None = None ,
585+ poe_mode : str | None = None ,
586+ poe_on : bool | None = None ,
587+ port_id : str | None = None ,
588+ port_mac : str | None = None ,
589+ power_draw : float | None = None ,
590+ tx_pkts : int | None = None ,
591+ rx_pkts : int | None = None ,
592+ rx_bytes : int | None = None ,
593+ tx_bps : int | None = None ,
594+ rx_bps : int | None = None ,
595+ tx_mcast_pkts : int | None = None ,
596+ tx_bcast_pkts : int | None = None ,
597+ rx_mcast_pkts : int | None = None ,
598+ rx_bcast_pkts : int | None = None ,
599+ speed : int | None = None ,
600+ stp_state : str | None = None ,
601+ stp_role : str | None = None ,
602+ auth_state : str | None = None ,
603+ up : bool | None = None ,
604+ site_id : str | None = None ,
605+ start : int | None = None ,
606+ end : int | None = None ,
607+ duration : str = "1d" ,
608+ limit : int = 100 ,
609+ ) -> _APIResponse :
610+ """
611+ API doc: https://www.juniper.net/documentation/us/en/software/mist/api/http/api/orgs/stats/ports/count-org-sw-or-gw-ports
612+
613+ PARAMS
614+ -----------
615+ mistapi.APISession : mist_session
616+ mistapi session including authentication and Mist host information
617+
618+ PATH PARAMS
619+ -----------
620+ org_id : str
621+
622+ QUERY PARAMS
623+ ------------
624+ distinct : str{'full_duplex', 'mac', 'neighbor_mac', 'neighbor_port_desc', 'neighbor_system_name', 'poe_disabled', 'poe_mode', 'poe_on', 'port_id', 'port_mac', 'speed', 'up'}, default: mac
625+ full_duplex : bool
626+ mac : str
627+ neighbor_mac : str
628+ neighbor_port_desc : str
629+ neighbor_system_name : str
630+ poe_disabled : bool
631+ poe_mode : str
632+ poe_on : bool
633+ port_id : str
634+ port_mac : str
635+ power_draw : float
636+ tx_pkts : int
637+ rx_pkts : int
638+ rx_bytes : int
639+ tx_bps : int
640+ rx_bps : int
641+ tx_mcast_pkts : int
642+ tx_bcast_pkts : int
643+ rx_mcast_pkts : int
644+ rx_bcast_pkts : int
645+ speed : int
646+ stp_state : str{'blocking', 'disabled', 'forwarding', 'learning', 'listening'}
647+ If `up`==`true`
648+ stp_role : str{'alternate', 'backup', 'designated', 'root', 'root-prevented'}
649+ If `up`==`true`
650+ auth_state : str{'authenticated', 'authenticating', 'held', 'init'}
651+ If `up`==`true` && has Authenticator role
652+ up : bool
653+ site_id : str
654+ start : int
655+ end : int
656+ duration : str, default: 1d
657+ limit : int, default: 100
658+
659+ RETURN
660+ -----------
661+ mistapi.APIResponse
662+ response from the API call
663+ """
664+
665+ uri = f"/api/v1/orgs/{ org_id } /stats/ports/count"
666+ query_params : dict [str , str ] = {}
667+ if distinct :
668+ query_params ["distinct" ] = str (distinct )
669+ if full_duplex :
670+ query_params ["full_duplex" ] = str (full_duplex )
671+ if mac :
672+ query_params ["mac" ] = str (mac )
673+ if neighbor_mac :
674+ query_params ["neighbor_mac" ] = str (neighbor_mac )
675+ if neighbor_port_desc :
676+ query_params ["neighbor_port_desc" ] = str (neighbor_port_desc )
677+ if neighbor_system_name :
678+ query_params ["neighbor_system_name" ] = str (neighbor_system_name )
679+ if poe_disabled :
680+ query_params ["poe_disabled" ] = str (poe_disabled )
681+ if poe_mode :
682+ query_params ["poe_mode" ] = str (poe_mode )
683+ if poe_on :
684+ query_params ["poe_on" ] = str (poe_on )
685+ if port_id :
686+ query_params ["port_id" ] = str (port_id )
687+ if port_mac :
688+ query_params ["port_mac" ] = str (port_mac )
689+ if power_draw :
690+ query_params ["power_draw" ] = str (power_draw )
691+ if tx_pkts :
692+ query_params ["tx_pkts" ] = str (tx_pkts )
693+ if rx_pkts :
694+ query_params ["rx_pkts" ] = str (rx_pkts )
695+ if rx_bytes :
696+ query_params ["rx_bytes" ] = str (rx_bytes )
697+ if tx_bps :
698+ query_params ["tx_bps" ] = str (tx_bps )
699+ if rx_bps :
700+ query_params ["rx_bps" ] = str (rx_bps )
701+ if tx_mcast_pkts :
702+ query_params ["tx_mcast_pkts" ] = str (tx_mcast_pkts )
703+ if tx_bcast_pkts :
704+ query_params ["tx_bcast_pkts" ] = str (tx_bcast_pkts )
705+ if rx_mcast_pkts :
706+ query_params ["rx_mcast_pkts" ] = str (rx_mcast_pkts )
707+ if rx_bcast_pkts :
708+ query_params ["rx_bcast_pkts" ] = str (rx_bcast_pkts )
709+ if speed :
710+ query_params ["speed" ] = str (speed )
711+ if stp_state :
712+ query_params ["stp_state" ] = str (stp_state )
713+ if stp_role :
714+ query_params ["stp_role" ] = str (stp_role )
715+ if auth_state :
716+ query_params ["auth_state" ] = str (auth_state )
717+ if up :
718+ query_params ["up" ] = str (up )
719+ if site_id :
720+ query_params ["site_id" ] = str (site_id )
721+ if start :
722+ query_params ["start" ] = str (start )
723+ if end :
724+ query_params ["end" ] = str (end )
725+ if duration :
726+ query_params ["duration" ] = str (duration )
727+ if limit :
728+ query_params ["limit" ] = str (limit )
729+ resp = mist_session .mist_get (uri = uri , query = query_params )
730+ return resp
731+
732+
575733def searchOrgSwOrGwPorts (
576734 mist_session : _APISession ,
577735 org_id : str ,
@@ -604,6 +762,7 @@ def searchOrgSwOrGwPorts(
604762 stp_state : str | None = None ,
605763 stp_role : str | None = None ,
606764 auth_state : str | None = None ,
765+ type : str = "all" ,
607766 limit : int = 100 ,
608767 start : int | None = None ,
609768 end : int | None = None ,
@@ -655,6 +814,8 @@ def searchOrgSwOrGwPorts(
655814 If `up`==`true`
656815 auth_state : str{'authenticated', 'authenticating', 'held', 'init'}
657816 If `up`==`true` && has Authenticator role
817+ type : str{'switch', 'gateway', 'all'}, default: all
818+ Type of device. enum: `switch`, `gateway`, `all`
658819 limit : int, default: 100
659820 start : int
660821 end : int
@@ -726,6 +887,8 @@ def searchOrgSwOrGwPorts(
726887 query_params ["stp_role" ] = str (stp_role )
727888 if auth_state :
728889 query_params ["auth_state" ] = str (auth_state )
890+ if type :
891+ query_params ["type" ] = str (type )
729892 if limit :
730893 query_params ["limit" ] = str (limit )
731894 if start :
0 commit comments