Class Port

Description

The Port class describes the interfaces to information on Ports and Switches This class extends the Common class.

Located in /lib/Port.php (line 26)

Common
   |
   --Port
Method Summary
 Port __construct (object $object)
 mixed getAlertMessage ()
 mixed getAlertSubject ()
 array getAllProps ()
 integer getLastVlanID ()
 mixed getNotifyInfo ()
 integer getOfficeID ()
 mixed getPatchInfo ()
 integer getPortID ()
 mixed getPortInfo ()
 mixed getSwitchInfo ()
 mixed getVMVlan ()
 boolean insertIfUnknown ()
 boolean isPortInDB ()
 boolean isSwitchInDB ()
 void restart ()
 mixed update ()
 mixed vlanBySwitchLocation ([ $vlan_id = 0])
 mixed __call ( $methodName,  $parameters)
 mixed __get (mixed $key)
Variables

Inherited Variables

Inherited from Common

Common::$conf
Common::$db_conn
Common::$logger
Methods
Constructor __construct (line 35)

The constructor takes the parameters needed to generate a Port object Access is read-only.

Port __construct (object $object)
  • object $object: A copy of the Request

Redefinition of:
Common::__construct()
Get the current instance of our Settings and Logger classes
check_calling_method (line 460)

Catch DB inserts.

Check if the function is called from a postconnect method in an object which is a child of Policy. This function should be called from inside the update method. To prevent inserting of code in other methods, new code should be added. This is a basic checking, in the future this code may be enhanced.

  • return: True if function was called from a valid method, false otherwise
boolean check_calling_method ()
getAlertMessage (line 626)

Get location information about where the port is, to help sysadmin to know where a certain event has happened

This method is used for alerting

  • return: String containing port location information
  • access: public
mixed getAlertMessage ()
getAlertSubject (line 615)

Get location information about where the port is, to help sysadmin to know where a certain event has happened

This method is used for alerting

  • return: String containing port location information
  • access: public
mixed getAlertSubject ()
getAllProps (line 249)

Return all properties assigned to this system. This method is here only for debugging purposes, please delete it after

  • return: All properties present in this object
  • access: public
array getAllProps ()
getLastVlanID (line 575)

Get the id of the last_vlan

  • return: Value of the 'last_vlan' property
  • access: public
integer getLastVlanID ()
getNotifyInfo (line 602)

Get list of people to notify about problems related to this switch

  • return: List of emails, NULL if nothing is defined
  • access: public
mixed getNotifyInfo ()
getOfficeID (line 566)

Get the id of the office where this port is located

  • return: Value of the 'office_id' property
  • access: public
integer getOfficeID ()
getPatchInfo (line 439)

Get patch information related to this port

  • return: Patch information
  • access: public
mixed getPatchInfo ()
getPortDefaultVlan (line 258)

Get the default vlan assigned to a Port

  • return: Vlan assigned to a port, false otherwise
  • access: public
mixed getPortDefaultVlan ()
getPortID (line 557)

Get the id for this port

  • return: Value of the 'port_id' property
  • access: public
integer getPortID ()
getPortInfo (line 593)

Get port name

  • return: Port name
  • access: public
mixed getPortInfo ()
getSwitchInfo (line 584)

Get switch information related to this port

  • return: Value of the 'switch_ip' and 'switch_comment' properties
  • access: public
mixed getSwitchInfo ()
getVMVlan (line 312)

Get the vlan used by a system seen on this same port during the last 2 hours.

This is usefull to assign a vlan for VMs without causing flapping.

  • return: Vlan to assign, false otherwise
  • access: public
mixed getVMVlan ()
insertIfUnknown (line 358)

Insert a switch or port into the DB if it doesn't exist.

  • return: True if an insert operation was performed, false otherwise
  • access: public
boolean insertIfUnknown ()
isPortInDB (line 349)

Tell if this port is in the DB

  • return: Value of the 'port_in_db' property
  • access: public
boolean isPortInDB ()
isSwitchInDB (line 340)

Tell if this switch is in the DB

  • return: Value of the 'switch_in_db' property
  • access: public
boolean isSwitchInDB ()
restart (line 635)

Restart port

  • access: public
void restart ()
update (line 527)

Update last_vlan and last_activity fields for this port

  • return: Port name and switch ip and name from updated port, false if no updated was performed
  • access: public
mixed update ()
vlanBySwitchLocation (line 273)

Get a vlan based on switch location. This vlan should be used as an exception to the regular process

  • return: Vlan to assign, false otherwise
  • access: public
mixed vlanBySwitchLocation ([ $vlan_id = 0])
  • $vlan_id
__call (line 163)

Universal Accessor Method We are redirecting all unresolved method calls to this handler, so that we can emulate arbitraty accessor methods.

With this trick, the user can add new fields to the system tables and will be able to access them in the policy as $system->getDBFieldName() without haveing to change this class

  • return: Property
  • throws: If the db field does not exist, Log Error and Deny as default action
  • access: public
mixed __call ( $methodName,  $parameters)
  • $methodName
  • $parameters
__get (line 192)

Get the value of one property if it exists

  • return: The value of the wanted property, or false if such a property doesn't exist
  • access: protected
mixed __get (mixed $key)
  • mixed $key: Property to lookup

Inherited Methods

Inherited From Common

 Common::__construct()
 Common::getConnection()
 Common::htmlescape()
 Common::log2db()
 Common::real_escape_string1()
 Common::sqlescape()

Documentation generated on Mon, 06 Oct 2008 01:10:37 +0200 by phpDocumentor 1.4.0