if (!array_key_exists ($sic[$argname], getPortIIFOptions()))
throw new InvalidRequestArgException ($argname, $sic[$argname], 'Unknown value');
break;
+ case 'vlan':
+ case 'vlan1':
+ genericAssertion ($argname, 'uint');
+ if ($argtype == 'vlan' and $sic[$argname] == VLAN_DFL_ID)
+ throw new InvalidRequestArgException ($argname, $sic[$argname], 'default VLAN cannot be changed');
+ if ($sic[$argname] > VLAN_MAX_ID or $sic[$argname] < VLAN_MIN_ID)
+ throw new InvalidRequestArgException ($argname, $sic[$argname], 'out of valid range');
+ break;
default:
throw new InvalidArgException ('argtype', $argtype); // comes not from user's input
}
100 => array ('code' => 'error', 'format' => '%s'),
102 => array ('code' => 'error', 'format' => "Error creating user account '%s'"),
104 => array ('code' => 'error', 'format' => "failed updating record '%s'"),
- 105 => array ('code' => 'error', 'format' => 'default VLAN cannot be changed'),
107 => array ('code' => 'error', 'format' => 'Assertion failed: %s'),
108 => array ('code' => 'error', 'format' => 'Database error: %s'),
109 => array ('code' => 'error', 'format' => 'failed updating a record'),
'arglist' => array
(
array ('url_argname' => 'vdom_id', 'table_colname' => 'domain_id', 'assertion' => 'uint'),
- array ('url_argname' => 'vlan_id', 'assertion' => 'uint'),
+ array ('url_argname' => 'vlan_id', 'assertion' => 'vlan'),
array ('url_argname' => 'vlan_type', 'assertion' => 'enum/vlan_type'),
array ('url_argname' => 'vlan_descr', 'assertion' => 'string0', 'if_empty' => 'NULL'),
),
);
+$opspec_list['vlandomain-vlanlist-del'] = array
+(
+ 'table' => 'VLANDescription',
+ 'action' => 'DELETE',
+ 'arglist' => array
+ (
+ array ('url_argname' => 'vdom_id', 'table_colname' => 'domain_id', 'assertion' => 'uint'),
+ array ('url_argname' => 'vlan_id', 'assertion' => 'vlan'),
+ ),
+);
+$opspec_list['vlandomain-vlanlist-upd'] = array
+(
+ 'table' => 'VLANDescription',
+ 'action' => 'UPDATE',
+ 'set_arglist' => array
+ (
+ array ('url_argname' => 'vlan_type', 'assertion' => 'enum/vlan_type'),
+ array ('url_argname' => 'vlan_descr', 'assertion' => 'string0', 'if_empty' => 'NULL'),
+ ),
+ 'where_arglist' => array
+ (
+ array ('url_argname' => 'vdom_id', 'table_colname' => 'domain_id', 'assertion' => 'uint'),
+ array ('url_argname' => 'vlan_id', 'assertion' => 'vlan'),
+ ),
+);
// This function is DEPRECATED. Show messages through showError and showSuccess,
// you dont need to return anything from an ophandler to redirect user back to the page containing submit form
return buildRedirectURL (__FUNCTION__, $result ? 'OK' : 'ERR', array(), NULL, NULL, $focus_hints);
}
-$msgcode['delVLANDescription']['OK'] = 49;
-$msgcode['delVLANDescription']['ERR1'] = 105;
-$msgcode['delVLANDescription']['ERR2'] = 111;
-function delVLANDescription ()
-{
- assertUIntArg ('vlan_id');
- global $sic;
- if ($sic['vlan_id'] == VLAN_DFL_ID)
- return buildRedirectURL (__FUNCTION__, 'ERR1');
- $result = commitReduceVLANDescription ($sic['vdom_id'], $sic['vlan_id']);
- return buildRedirectURL (__FUNCTION__, $result ? 'OK' : 'ERR2');
-}
-
-$msgcode['updVLANDescription']['OK'] = 51;
-$msgcode['updVLANDescription']['ERR1'] = 105;
-function updVLANDescription ()
-{
- assertUIntArg ('vlan_id');
- assertStringArg ('vlan_type');
- assertStringArg ('vlan_descr', TRUE);
- global $sic;
- if ($sic['vlan_id'] == VLAN_DFL_ID)
- return buildRedirectURL (__FUNCTION__, 'ERR1');
- usePreparedUpdateBlade
- (
- 'VLANDescription',
- array
- (
- 'vlan_descr' => !mb_strlen ($sic['vlan_descr']) ? NULL : $sic['vlan_descr'],
- 'vlan_type' => $sic['vlan_type'],
- ),
- array
- (
- 'domain_id' => $sic['vdom_id'],
- 'vlan_id' => $sic['vlan_id'],
- )
- );
- return buildRedirectURL (__FUNCTION__, 'OK');
-}
-
$msgcode['createVLANDomain']['OK'] = 48;
$msgcode['createVLANDomain']['ERR'] = 110;
function createVLANDomain ()