public function createVirtualSystem($vsysID, $displayName = '') { if (!is_numeric($vsysID)) { derr("new vsys id must be an integer but '{$vsysID}' was provided"); } $newVsysName = 'vsys' . $vsysID; if ($this->findVirtualSystem($newVsysName) !== null) { derr("cannot create '{$newVsysName}' because it already exists"); } $xmlNode = DH::importXmlStringOrDie($this->xmldoc, VirtualSystem::$templateXml); $xmlNode->setAttribute('name', $newVsysName); if (strlen($displayName) > 0) { DH::createElement($xmlNode, 'display-name', $displayName); } $this->vsyssroot->appendChild($xmlNode); $newVsys = new VirtualSystem($this); $newVsys->load_from_domxml($xmlNode); $this->virtualSystems[] = $newVsys; return $newVsys; }