Ok.  I am using only Cisco so I assume I will be modifying the
/usr/local/pf/lib/pf/Switch/Cisco.pm file.  I took a look at it and the
subs getVmVlanType and setVmVlanType are similar to what I need to do.  So
I "borrowed" heavily from them and came up with this:

sub getFlowControl {
    my ( $this, $ifIndex ) = @_;
    my $logger = Log::Log4perl::get_logger( ref($this) );
    if ( !$this->connectRead() ) {
        return 0;
    }
    my $OID_FlowControl
        = '1.3.6.1.4.1.9.5.1.4.1.1.13';    #CISCO-STACK-MIB
    $logger->trace(
        "SNMP get_request for FlowControl: $OID_FlowControl.$ifIndex");
    my $result = $this->{_sessionRead}
        ->get_request( -varbindlist => ["$OID_FlowControl.$ifIndex"] );
    if ( exists( $result->{"$OID_FlowControl.$ifIndex"} )
        && ( $result->{"$OID_FlowControl.$ifIndex"} ne 'noSuchInstance' ) )
    {
        return $result->{"$OID_FlowControl.$ifIndex"};
    } elsif ( $this->isTrunkPort($ifIndex) ) {
        return 4;
    } else {
        return 0;
    }
}

sub setFlowControl {
    my ( $this, $ifIndex, $fctype ) = @_;
    my $logger = Log::Log4perl::get_logger( ref($this) );
    $logger->info( "setting port $ifIndex FlowControl from "
            . $this->getFlowControl($ifIndex)
            . " to $fctype" );
    if ( !$this->isProductionMode() ) {
        $logger->info(
            "not in production mode ... we won't change this port
FlowControl"
        );
        return 1;
    }
    if ( !$this->connectWrite() ) {
        return 0;
    }
    my $OID_FlowControl
        = '1.3.6.1.4.1.9.5.1.4.1.1.13';    #CISCO-STACK-MIB
    $logger->trace("SNMP set_request for FlowControl: $OID_FlowControl");
    my $result = $this->{_sessionWrite}->set_request( -varbindlist =>
            [ "$OID_FlowControl.$ifIndex", Net::SNMP::INTEGER, $fctype ] );
    return ( defined($result) );
}


I changed the OID to the OID for portAdminRXFlowControl.  I changed the
variable $type to $fctype.  I assume my new $fctype variable will need
declared somewhere and the value set to 3 (desirable) for the vlanid 33 I
need flow control set on and then set to 2 (off) as the default to cover
all other vlans.  I am also assuming I just copy my new getFlowControl and
setFlowControl into the Cisco.pm file and I am all set (wishful thinking I
am sure).

Are my assumption here correct?  What would the next step be?

Thanks again.

Chuck


Original email:
-----------------
From: Fabrice DURAND [email protected]
Date: Mon, 14 Jul 2014 08:26:59 -0400
To: [email protected]
Subject: Re: [PacketFence-users] Custom switch port configuration based
onVLAN assignment


Hi Chuck,

in fact you have to find in the mib the way to set this values for a 
specific ifindex.
When you will successfully find the correct to do that (snmp-set ...) 
then you will have to include this action in the switch module.

Regards
Fabrice

Le 2014-07-14 04:09, [email protected] a écrit :
> New to Packetfense and learning a lot through trial by fire.  I have a few
> "Outside the box" issues I hope someone can help with.  Here is the big
> one.  We have an image deployment VLAN that we will assign system to based
> on unknown MAC and/or User registration. Ports in that VLAN (VLANID 33)
> need to have the port flow control and speed set.  These are the port
> config commands that need added when the port is assigned to VLAN 33:
>
> interface GigabitEthernet0/1
>   speed 1000
>   duplex full
>   flowcontrol receive desired
>   
>
> I have not been able to find any information of having PacketFence set
port
> commands via SNMP or CLI.  I am using SNMP v3.
>
> Any help would be greatly appreciated.
>
> Chuck
>
> --------------------------------------------------------------------
> myhosting.com - Premium Microsoft Windows and Linux web and application
> hosting - http://link.myhosting.com/myhosting
>
>
>
>
----------------------------------------------------------------------------
--
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck®
> Code Sight™ - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> PacketFence-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/packetfence-users


-- 
Fabrice Durand
[email protected] ::  +1.514.447.4918 (x135) ::  www.inverse.ca
Inverse inc. :: Leaders behind SOGo (http://www.sogo.nu) and PacketFence
(http://packetfence.org)


----------------------------------------------------------------------------
--
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck®
Code Sight™ - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users


--------------------------------------------------------------------
mail2web LIVE  Free email based on Microsoft Exchange technology -
http://link.mail2web.com/LIVE



------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users

Reply via email to