Difference between revisions of "Freeside:3:Documentation:Developer/FS/router"

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
 
m (Edit via perl MediaWiki framework (1.13))
 
Line 26: Line 26:
 
; insert
 
; insert
 
:Adds this record to the database. If there is an error, returns the error, otherwise returns false.
 
:Adds this record to the database. If there is an error, returns the error, otherwise returns false.
; delete
+
 
:Deletes this record from the database. If there is an error, returns the error, otherwise returns false.
+
:If the pseudo-field 'blocknum' is set to an [[Freeside:3:Documentation:Developer/FS/addr block|FS::addr_block]] number, then that address block will be assigned to this router. Currently only one block can be assigned this way.
 
; replace OLD_RECORD
 
; replace OLD_RECORD
 
:Replaces OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
 
:Replaces OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
Line 33: Line 33:
 
:Checks all fields to make sure this is a valid record. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
 
:Checks all fields to make sure this is a valid record. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
 
; delete
 
; delete
:Deletes this router if and only if no address blocks (see [[Freeside:3:Documentation:Developer/FS/addr block|FS::addr_block]]) are currently allocated to it.
+
:Deallocate all address blocks from this router and delete it.
 
; addr_block
 
; addr_block
 
:Returns a list of FS::addr_block objects (address blocks) associated with this object.
 
:Returns a list of FS::addr_block objects (address blocks) associated with this object.
Line 44: Line 44:
 
; agent
 
; agent
 
:Returns the agent associated with this router, if any.
 
:Returns the agent associated with this router, if any.
 +
; cust_svc
 +
:Returns the cust_svc associated with this router, if any. This should be the service that ''provides connectivity to the router'', not any service connected ''through'' the router.
  
 
==SEE ALSO==
 
==SEE ALSO==
 
FS::svc_broadband, FS::router, FS::addr_block, FS::part_svc, schema.html from the base documentation.
 
FS::svc_broadband, FS::router, FS::addr_block, FS::part_svc, schema.html from the base documentation.

Latest revision as of 13:39, 27 June 2014

NAME

FS::router - Object methods for router records

SYNOPSIS

 use FS::router;

 $record = new FS::router \%hash;
 $record = new FS::router { 'column' => 'value' };

 $error = $record->insert;

 $error = $new_record->replace($old_record);

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::router record describes a broadband router, such as a DSLAM or a wireless access point. FS::router inherits from FS::Record. The following fields are currently supported:

routernum - primary key; routername - descriptive name for the router; svcnum - svcnum of the owning FS::svc_broadband, if appropriate; manual_addr - set to 'Y' to allow services linked to this router to have any IP address, rather than one in an address block belonging to the router.

METHODS

new HASHREF
Create a new record. To add the record to the database, see "insert".
insert
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
If the pseudo-field 'blocknum' is set to an FS::addr_block number, then that address block will be assigned to this router. Currently only one block can be assigned this way.
replace OLD_RECORD
Replaces OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
check
Checks all fields to make sure this is a valid record. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
delete
Deallocate all address blocks from this router and delete it.
addr_block
Returns a list of FS::addr_block objects (address blocks) associated with this object.
auto_addr_block
Returns a list of address blocks on which auto-assignment of IP addresses is enabled.
part_svc_router
Returns a list of FS::part_svc_router objects associated with this object. This is unlikely to be useful for any purpose other than retrieving the associated FS::part_svc objects. See below.
part_svc
Returns a list of FS::part_svc objects associated with this object.
agent
Returns the agent associated with this router, if any.
cust_svc
Returns the cust_svc associated with this router, if any. This should be the service that provides connectivity to the router, not any service connected through the router.

SEE ALSO

FS::svc_broadband, FS::router, FS::addr_block, FS::part_svc, schema.html from the base documentation.