public function action_index() { if ($_POST) { $val = \Validation::forge(); $val->add_field('dev', 'Device id', 'required|min_length[1]|max_length[20]'); $val->add_field('type', 'Input or output', 'required|min_length[1]|max_length[20]'); if ($val->run()) { $kvm = Model_Device_Kvm::find()->where('deviceID', $val->validated('dev'))->get_one(); if ($kvm) { $type = $val->validated('type'); $out = array('status' => 'ok', 'cables' => array(), 'ports' => array()); $sockets = $kvm->socket; foreach ($sockets as $socket) { if ($type == 1 && $socket->type == 2) { array_push($out['ports'], array('id' => $socket->id)); } if ($type == 2 && $socket->type == 1) { array_push($out['ports'], array('id' => $socket->id)); } } $cabels = Model_Cable::find()->where('dev1', $kvm->deviceID)->where('type', 3)->or_where('dev2', $kvm->deviceID)->where('type', 3)->get(); //$out['ports']=$ports; foreach ($cabels as $cab) { array_push($out['cables'], array('id' => $cab->id, 'dev1' => $cab->dev1, 'port1' => $cab->port1, 'dev2' => $cab->dev2, 'port2' => $cab->port2, 'name1' => $cab->name1, 'name2' => $cab->name2, 'type' => $cab->type)); } } else { $out = array('status' => 'nop'); } echo json_encode($out); } } }
public function action_index() { if (isset($this->field)) { $data = array(); $data['pdu'] = $this->field->power; if ($this->tmpl) { $data['cables'] = array(); } else { $data['cables'] = Model_Cable::find()->where('type', 2)->where('dev1', $this->field->deviceID)->or_where('dev2', $this->field->deviceID)->get(); } $data['err'] = ''; if ($this->isSuplly()) { $data['maxout'] = 42; if (!$this->tmpl) { if ($this->field->device->meta_default_data > 0) { $data['maxout'] = 42; } else { $data['maxout'] = 24; } } return \Response::forge(\View::forge('power/supply', $data)); } else { return \Response::forge(\View::forge('power/consumer', $data)); } } }
public function action_index() { if (isset($this->field)) { $val = \Validation::forge(); $out = true; $val->add_field('act', 'action id', 'required|min_length[1]|max_length[20]'); $val->add_field('val', 'value', 'required|min_length[1]'); if ($val->run()) { $data['err'] = ''; $size = $val->validated('val'); $kvm = $this->field->kvm; if ($this->tmpl) { $data['cables'] = array(); } else { $data['cables'] = Model_Cable::find()->where('type', 2)->where('dev1', $this->field->deviceID)->or_where('dev2', $this->field->deviceID)->get(); } switch ($val->validated('act')) { case 'act1': //current //$pdu->current=$size; break; case 'act2': //input sockets if ($this->tmpl) { $ip_q = Model_Device_Template_Kvm_Socket::find()->where('kvmID', $kvm->id)->where('type', 1); } else { $ip_q = Model_Device_Kvm_Socket::find()->where('kvmID', $kvm->id)->where('type', 1); } $this->fix_fields($size, $ip_q->count(), 1); $kvm->input = $size; break; case 'act3': //output sockets if ($this->tmpl) { $ip_q = Model_Device_Template_Kvm_Socket::find()->where('kvmID', $kvm->id)->where('type', 2); } else { $ip_q = Model_Device_Kvm_Socket::find()->where('kvmID', $kvm->id)->where('type', 2); } //if($this->check_boundary($pdu, $size)){ $this->fix_fields($size, $ip_q->count(), 2); $kvm->output = $size; break; } $kvm->save(); $out = true; if ($out) { $data['kvm'] = $this->field->kvm; if ($this->isKVM()) { return \Response::forge(\View::forge('kvm/supply', $data)); } else { return \Response::forge(\View::forge('kvm/consumer', $data)); } } } } }
public function action_index() { if ($_POST) { $val = \Validation::forge(); $val->add_field('id', 'id', 'required|min_length[1]|max_length[20]'); //print_r($_POST); if ($val->run()) { $cable = Model_Cable::find($val->validated('id')); if ($cable) { $cable->delete(); echo json_encode(array('save' => 'true')); } } } }
public function action_index() { if (isset($this->field)) { $data = array(); $data['kvm'] = $this->field->kvm; if ($this->tmpl) { $data['cables'] = array(); } else { $data['cables'] = Model_Cable::find()->where('type', 3)->where('dev1', $this->field->deviceID)->or_where('dev2', $this->field->deviceID)->get(); } $data['err'] = ''; if ($this->isKVM()) { return \Response::forge(\View::forge('kvm/supply', $data)); } else { return \Response::forge(\View::forge('kvm/consumer', $data)); } } }
public function action_remove() { $out = array(); $out['stat'] = false; if ($_POST) { $val = \Validation::forge('rack'); $val->add_field('rid', 'rack id', 'required|min_length[1]|max_length[20]'); if ($val->run()) { $rack = Model_Rack::find($val->validated('rid')); if ($rack) { $devices = $rack->device; //delete devices foreach ($devices as $dev) { //remove cables $cables = Model_Cable::find()->where('dev1', $dev->id)->or_where('dev2', $dev->id)->get(); foreach ($cables as $cab) { $cab->delete(); } //get all device field and delete him $dev_fields = Model_Device_Fieldset::find()->where('deviceID', $dev->id)->get(); //we must go with foreach becouse image deleting from hdd foreach ($dev_fields as $dev_field) { $dev_field->delete(); } $dev->delete(); } //shift room position $ord = $rack->room_pos; $room = $rack->room; //delete rack $rack->delete(); $out['stat'] = true; //set room_pos-- on racks with larger room_pos $racks = Model_Rack::find()->where('room', $room)->where('room_pos', '>', $ord)->get(); foreach ($racks as $rack) { $rack->room_pos -= 1; $rack->save(); } } } } echo json_encode($out); }
public function action_window($id = null) { if ($id) { $val = \Validation::forge(); $val->add_field('tab', 'Device menu tab id', 'required|min_length[1]|max_length[2]'); if ($val->run()) { $device = Model_Device::find($id); if ($device) { $data['device'] = $device; $data['cables'] = array(); switch ($device->type) { /* //device type not set case 0: return \Response::forge(\View::forge('device/window/notype',$data)); break; //server */ default: switch ($val->validated('tab')) { case 4: $data['notes'] = Model_Notes::find()->where('deviceID', $device->id)->get(); return \Response::forge(\View::forge('device/window/notes', $data)); break; case 2: $data['cables'] = Model_Cable::find()->where('dev1', $device->id)->or_where('dev2', $device->id)->get(); default: $fields = Model_Device_Fieldset::find()->where('deviceID', $device->id)->where('tab', $val->validated('tab'))->get(); $data['fields'] = $fields; $data['device'] = $device; return \Response::forge(\View::forge('device/window/hardware', $data)); break; } break; } } } //print_r($_POST); } }
public function action_index() { if ($_POST) { $val = \Validation::forge(); $val->add_field('dev1', 'Device id', 'required|min_length[1]|max_length[20]'); $val->add_field('dev2', 'Device id', 'required|min_length[1]|max_length[20]'); $val->add_field('port1', 'Device id', 'required|min_length[1]|max_length[20]'); $val->add_field('port2', 'Device id', 'required|min_length[1]|max_length[20]'); $val->add_field('name1', 'Device id', 'required|min_length[1]|max_length[20]'); $val->add_field('name2', 'Device id', 'required|min_length[1]|max_length[20]'); $val->add_field('cab', 'Existing cable id', 'required|min_length[1]|max_length[20]'); $val->add_field('type', 'UTP, power...', 'required|min_length[1]|max_length[20]'); if ($val->run()) { //if user reconnect use existing cable if ($val->validated('cab') > 0) { $cable = Model_Cable::find($val->validated('cab')); $cable->dev1 = $val->validated('dev1'); $cable->port1 = $val->validated('port1'); $cable->port2 = $val->validated('port2'); $cable->dev2 = $val->validated('dev2'); $cable->name1 = $val->validated('name1'); $cable->name2 = $val->validated('name2'); $cable->type = $val->validated('type'); $cable->meta_update_time = time(); } else { $props = array('dev1' => $val->validated('dev1'), 'port1' => $val->validated('port1'), 'dev2' => $val->validated('dev2'), 'port2' => $val->validated('port2'), 'name1' => $val->validated('name1'), 'name2' => $val->validated('name2'), 'type' => $val->validated('type'), 'meta_update_time' => time(), 'meta_update_user' => $this->user); $cable = new Model_Cable($props); } $cable->save(); $out = array('cable' => array()); $m = array('id' => $cable->id, 'dev1' => $cable->dev1, 'port1' => $cable->port1, 'port2' => $cable->port2, 'dev2' => $cable->dev2, 'name1' => $cable->name1, 'name2' => $cable->name2, 'type' => $cable->type); array_push($out['cable'], $m); echo json_encode($out); } } /* if(isset($this->field)){ if(!$this->field->network){ $prop=Array( 'fieldsetID'=>$this->field->id, 'deviceID'=>$this->field->device->id, 'nics'=>0, 'vports'=>0, 'ports'=>0, 'uplinks'=>0, 'config_data'=>'', 'type'=>$this->net_type ); $this->network=new Model_Device_Network($prop); $this->network->save(); } $data=$this->data(); return \Response::forge(\View::forge('network/windata',$data)); } */ }
private function add_server($pos, $rack, $user, $sw, $macs, $pdu) { $pduid = $pdu['id']; $sockets = $pdu['sockets']; $hostnames = array("", "", "", "", "", "", "", "", "", "akcp-sp2", "c1-activedirectory-1", "c1-activedirectory-2", "c1-activedirectory-3", "c1-dns-1", "c1-dns-2", "c1-dns-3", "c1-dns-4", "c1-exchange-1", "c1-exchange-2", "c1-exchange-3", "c1-exchange-4", "c1-linux-1", "c1-linux-2", "c1-linux-3", "c1-linux-4", "c1-linux-5", "c1-mysql-1", "c1-mysql-2", "c1-mysql-3", "c1-mysql-4", "c1-web-1", "c1-web-2", "c1-web-3", "c1-web-4", "c1-windows-1", "c1-windows-2", "c1-windows-3", "c1-windows-4", "c1-windows-5", "c1-windows-6", "c2-exchange-3", "c2-exchange-4", "c2-mysql-1", "c2-mysql-2", "c2-web-1", "c2-windows-1", "c2_windows-2", "c3-linux-1", "c3-linux-2", "c3-linux-3", "c3-linux-4", "c3-windows-1", "c3-windows-2", "c3-windows-3", "fujitsu-tx-s2", "knuerr-diview", "knuerr-rmsII", "messpc", "sensatronics-e4", "sensatronics-em1", "sensatronics-senturion"); $props = array('hostname' => $hostnames[$pos], 'type' => 0, 'cat' => 1, 'rack' => $rack->id, 'rack_pos' => $pos, 'rack_units' => 1, 'parent_device' => 0, 'meta_default_data' => 0, 'meta_update_time' => time(), 'meta_update_user' => $user); //print_r($props); $server = new Model_Device($props); $server->save(); $this->net_type = 1; $this->add_device_default_fields($server); $network = Model_Device_Network::find()->where('deviceID', $server->id)->get_one(); $network->nics = 2; $network->save(); for ($i = 0; $i <= 1; $i++) { $prop = array('networkID' => $network->id, 'nic_name' => '', 'ipv4' => '192.168.8.' . $i, 'ipv6' => '', 'conn_type' => 1, 'conn_speed' => 3, 'type' => 1); $ip = new Model_Network_Ip($prop); $ip->save(); } //add cabel $props = array('dev1' => $sw, 'port1' => $macs[$pos - 9], 'dev2' => $server->id, 'port2' => $ip->id, 'name1' => $pos - 9, 'name2' => 2, 'type' => 1, 'meta_update_time' => time(), 'meta_update_user' => $user); $cable = new Model_Cable($props); $cable->save(); $power = Model_Device_Power::find()->where('deviceID', $server->id)->get_one(); $powsockets = $power->socket; foreach ($powsockets as $sock) { $n = $pos - 9; $props = array('dev1' => $pduid, 'port1' => $sockets[38 - $n], 'dev2' => $server->id, 'port2' => $sock->id, 'name1' => $pos - 9, 'name2' => 1, 'type' => 2, 'meta_update_time' => time(), 'meta_update_user' => $user); $cable = new Model_Cable($props); $cable->save(); } /* $props=Array( 'dev1'=>$sw, 'port1'=>$macs[$pos-9], 'dev2'=>$server->id, 'port2'=>$ip->id, 'name1'=>$pos-9, 'name2'=>1, 'type'=>2, 'meta_update_time'=>time(), 'meta_update_user'=>$user ); $cable=new Model_Cable($props); $cable->save(); */ return $server; }
public function data() { $data = array('net_type' => $this->net_type, 'con_type' => $this->con_type, 'net' => $this->field->network); if ($this->net_type == 1) { $data['conn'] = $this->connection_data(); if ($this->tmpl) { $data['ips'] = Model_Device_Template_Network_Ip::find()->where('tempnetID', $this->field->network->id)->order_by('type', 'asc')->order_by('id', 'asc')->get(); } else { $data['ips'] = Model_Network_Ip::find()->where('networkID', $this->field->network->id)->order_by('type', 'asc')->order_by('id', 'asc')->get(); } } if ($this->net_type == 2) { $data['conn'] = $this->connection_data(); if ($this->tmpl) { $data['ips'] = Model_Device_Template_Network_Ip::find()->where('tempnetID', $this->field->network->id)->order_by('type', 'asc')->order_by('id', 'asc')->get(); $data['macs'] = Model_Device_Template_Network_Mac::find()->where('tempnetID', $this->field->network->id)->order_by('id', 'asc')->get(); $data['vlans'] = Model_Device_Template_Network_Vlan::find()->where('tempnetID', $this->field->network->id)->order_by('id', 'asc')->get(); } else { $data['ips'] = Model_Network_Ip::find()->where('networkID', $this->field->network->id)->order_by('type', 'asc')->order_by('id', 'asc')->get(); $data['macs'] = Model_Network_Mac::find()->where('networkID', $this->field->network->id)->order_by('id', 'asc')->get(); $data['vlans'] = Model_Network_Vlan::find()->where('networkID', $this->field->network->id)->order_by('id', 'asc')->get(); } } if ($this->net_type == 3) { $data['conn'] = $this->connection_data(); if ($this->tmpl) { $data['ips'] = Model_Device_Template_Network_Ip::find()->where('tempnetID', $this->field->network->id)->order_by('type', 'asc')->order_by('id', 'asc')->get(); $data['macs'] = Model_Device_Template_Network_Mac::find()->where('tempnetID', $this->field->network->id)->order_by('id', 'asc')->get(); $data['vlans'] = Model_Device_Template_Network_Vlan::find()->where('tempnetID', $this->field->network->id)->order_by('id', 'asc')->get(); } else { $data['ips'] = Model_Network_Ip::find()->where('networkID', $this->field->network->id)->order_by('type', 'asc')->order_by('id', 'asc')->get(); $data['macs'] = Model_Network_Mac::find()->where('networkID', $this->field->network->id)->order_by('id', 'asc')->get(); $data['vlans'] = Model_Network_Vlan::find()->where('networkID', $this->field->network->id)->order_by('id', 'asc')->get(); } } if ($this->tmpl) { $data['cables'] = array(); //Model_Cable::find()->where('dev1',$this->field->templateID)->or_where('dev2',$this->field->templateID)->get(); } else { $data['cables'] = Model_Cable::find()->where('dev1', $this->field->deviceID)->or_where('dev2', $this->field->deviceID)->get(); } return $data; }
public function action_index() { if ($_POST) { $val = \Validation::forge(); $val->add_field('dev1', 'dev1', 'required|min_length[1]|max_length[20]'); $val->add_field('dev2', 'dev2', 'required|min_length[1]|max_length[20]'); $val->add_field('name1', 'name1', 'required|min_length[1]|max_length[200]'); $val->add_field('name2', 'name2', 'required|min_length[1]|max_length[200]'); $val->add_field('port1', 'name1', 'required|min_length[1]|max_length[200]'); $val->add_field('port2', 'name2', 'required|min_length[1]|max_length[200]'); $val->add_field('type', 'type', 'required|min_length[1]|max_length[3]'); $val->add_field('act', 'action', 'required|min_length[1]|max_length[30]'); $val->add_field('cab', 'action', 'max_length[30]'); //print_r($_POST); if ($val->run()) { \Log::debug("port1 " . $val->validated('port1')); \Log::debug("port2 " . $val->validated('port2')); $device1 = \Basic\Model_Device::find($val->validated('dev1')); $device2 = \Basic\Model_Device::find($val->validated('dev2')); switch ($val->validated('type')) { //network case 1: case 4: //if() $port1 = $this->getDevicePort($device1, $val->validated('name1'), $val->validated('type')); $port2 = $this->getDevicePort($device2, $val->validated('name2'), $val->validated('type')); break; case 2: case 3: $port1 = $val->validated('port1'); $port2 = $val->validated('port2'); break; } //$cable->save(); switch ($val->validated('act')) { case 'connect': $props = array('dev1' => $val->validated('dev1'), 'port1' => $port1, 'dev2' => $val->validated('dev2'), 'port2' => $port2, 'name1' => $val->validated('name1'), 'name2' => $val->validated('name2'), 'type' => $val->validated('type'), 'meta_update_time' => time(), 'meta_update_user' => $this->user); $cable = new Model_Cable($props); $cable->save(); $m = array('id' => $cable->id, 'dev1' => $cable->dev1, 'port1' => $cable->port1, 'port2' => $cable->port2, 'dev2' => $cable->dev2, 'name1' => $cable->name1, 'name2' => $cable->name2, 'type' => $cable->type, 'hostname1' => $device1->hostname, 'hostname2' => $device2->hostname); echo json_encode(array('cable' => $m)); break; case 'move': //print_r($_POST); $cable = Model_Cable::find($val->validated('cab')); if ($cable) { $cable->dev1 = $val->validated('dev1'); $cable->port1 = $port1; $cable->dev2 = $val->validated('dev2'); $cable->port2 = $port2; $cable->name1 = $val->validated('name1'); $cable->name2 = $val->validated('name2'); $cable->meta_update_time = time(); $cable->save(); $m = array('id' => $cable->id, 'dev1' => $cable->dev1, 'port1' => $cable->port1, 'port2' => $cable->port2, 'dev2' => $cable->dev2, 'name1' => $cable->name1, 'name2' => $cable->name2, 'type' => $cable->type, 'hostname1' => $device1->hostname, 'hostname2' => $device2->hostname); echo json_encode(array('cable' => $m)); } break; } /* $room=Model_Room::find($val->validated('room')); if($room){ $query = DB::query('select distinct cables.* from cables, rack, device where rack.room='.$room->id.' and device.rack=rack.id and (device.id=cables.dev1 or device.id=cables.dev2)'); $cables=$query->as_object()->execute(); $cabledata=Array(); foreach($cables as $cab){ array_push($cabledata,Array( 'id'=>$cab->id, 'dev1'=>$cab->dev1, 'port1'=>$cab->port1, 'dev2'=>$cab->dev2, 'port2'=>$cab->port2, 'name1'=>$cab->name1, 'name2'=>$cab->name2, 'type'=>$cab->type )); } $data['cabledata']=$cabledata; $data['room']=$room; return \Response::forge(View::forge('cables/rack',$data)); } */ } } }
public function action_index() { if (isset($this->field)) { $val = \Validation::forge(); $out = true; $val->add_field('act', 'action id', 'required|min_length[1]|max_length[20]'); $val->add_field('val', 'value', 'required|min_length[1]'); if ($val->run()) { $data['err'] = ''; $size = $val->validated('val'); $pdu = $this->field->power; if ($this->tmpl) { $data['cables'] = array(); } else { $data['cables'] = Model_Cable::find()->where('type', 2)->where('dev1', $this->field->deviceID)->or_where('dev2', $this->field->deviceID)->get(); } switch ($val->validated('act')) { case 'act1': //current $pdu->current = $size; break; case 'act2': //input sockets if ($this->tmpl) { $ip_q = Model_Device_Template_Power_Socket::find()->where('powerID', $pdu->id)->where('type', 1); } else { $ip_q = Model_Device_Power_Socket::find()->where('powerID', $pdu->id)->where('type', 1); } $this->fix_fields($size, $ip_q->count(), 1); $pdu->input = $size; break; case 'act3': //output sockets if ($this->tmpl) { $ip_q = Model_Device_Template_Power_Socket::find()->where('powerID', $pdu->id)->where('type', 2); } else { $ip_q = Model_Device_Power_Socket::find()->where('powerID', $pdu->id)->where('type', 2); } if ($this->check_boundary($pdu, $size)) { $this->fix_fields($size, $ip_q->count(), 2); $pdu->output = $size; } else { $data['err'] = 'Output number of sockets is to large for rack, there is no enough empty space in rack!'; } break; } $pdu->save(); $out = true; if ($out) { $data['pdu'] = $this->field->power; if ($this->isSuplly()) { $data['maxout'] = 42; if (!$this->tmpl) { if ($this->field->device->meta_default_data > 0) { $data['maxout'] = 42; } else { $data['maxout'] = 24; } } return \Response::forge(\View::forge('power/supply', $data)); } else { return \Response::forge(\View::forge('power/consumer', $data)); } } } } }
private function add_server($pos, $rack, $user, $sw, $macs, $pdu) { $pduid = $pdu['id']; $sockets = $pdu['sockets']; $props = array('hostname' => 's' . $pos . '.rck1.fl1.noclayer.com', 'type' => 0, 'cat' => 1, 'rack' => $rack->id, 'rack_pos' => $pos, 'rack_units' => 1, 'parent_device' => 0, 'meta_default_data' => 0, 'meta_update_time' => time(), 'meta_update_user' => $user); //print_r($props); $server = new Model_Device($props); $server->save(); $this->net_type = 1; $this->add_device_default_fields($server); $network = Model_Device_Network::find()->where('deviceID', $server->id)->get_one(); $network->nics = 2; $network->save(); for ($i = 0; $i <= 1; $i++) { $prop = array('networkID' => $network->id, 'nic_name' => '', 'ipv4' => '192.168.8.' . $i, 'ipv6' => '', 'conn_type' => 1, 'conn_speed' => 3, 'type' => 1); $ip = new Model_Network_Ip($prop); $ip->save(); } //add cabel $props = array('dev1' => $sw, 'port1' => $macs[$pos - 9], 'dev2' => $server->id, 'port2' => $ip->id, 'name1' => $pos - 9, 'name2' => 2, 'type' => 1, 'meta_update_time' => time(), 'meta_update_user' => $user); $cable = new Model_Cable($props); $cable->save(); $power = Model_Device_Power::find()->where('deviceID', $server->id)->get_one(); $powsockets = $power->socket; foreach ($powsockets as $sock) { $n = $pos - 9; $props = array('dev1' => $pduid, 'port1' => $sockets[38 - $n], 'dev2' => $server->id, 'port2' => $sock->id, 'name1' => $pos - 9, 'name2' => 1, 'type' => 2, 'meta_update_time' => time(), 'meta_update_user' => $user); $cable = new Model_Cable($props); $cable->save(); } /* $props=Array( 'dev1'=>$sw, 'port1'=>$macs[$pos-9], 'dev2'=>$server->id, 'port2'=>$ip->id, 'name1'=>$pos-9, 'name2'=>1, 'type'=>2, 'meta_update_time'=>time(), 'meta_update_user'=>$user ); $cable=new Model_Cable($props); $cable->save(); */ return $server; }
private function fix_fields($new_size, $total, $type) { if ($new_size < $total) { $dif = $total - $new_size; } else { $dif = $new_size - $total; } if ($total > $new_size) { //delete overage fileds if ($this->tmpl) { $ip_data = Model_Device_Template_Network_Ip::find()->where('tempnetID', $this->field->network->id)->where('type', $type)->limit($dif)->order_by('id', 'desc')->get(); } else { $ip_data = Model_Network_Ip::find()->where('networkID', $this->field->network->id)->where('type', $type)->limit($dif)->order_by('id', 'desc')->get(); } foreach ($ip_data as $ip) { //erase cables connected to that ip port as dev1:port1 $cable = Model_Cable::find()->where('dev1', $ip->network->deviceID)->where('type', 1)->where('port1', $ip->id)->get(); foreach ($cable as $cab) { $cab->delete(); } //erase cables connected to that ip port as dev2:port2 $cable = Model_Cable::find()->where('dev2', $ip->network->deviceID)->where('type', 1)->where('port2', $ip->id)->get(); foreach ($cable as $cab) { $cab->delete(); } $ip->delete(); } } else { //add new empty fields (diference) if ($total < $new_size) { for ($i = 0; $i < $dif; $i++) { if ($this->tmpl) { $prop = array('tempnetID' => $this->field->network->id, 'nic_name' => '', 'ipv4' => '', 'ipv6' => '', 'conn_type' => 0, 'conn_speed' => 0, 'type' => $type); $ip = new Model_Device_Template_Network_Ip($prop); } else { $prop = array('networkID' => $this->field->network->id, 'nic_name' => '', 'ipv4' => '', 'ipv6' => '', 'conn_type' => 0, 'conn_speed' => 0, 'type' => $type); $ip = new Model_Network_Ip($prop); } $ip->save(); } } } }