Package Products :: Package ZenModel :: Module OperatingSystem
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenModel.OperatingSystem

  1  ########################################################################### 
  2  # 
  3  # This program is part of Zenoss Core, an open source monitoring platform. 
  4  # Copyright (C) 2007, Zenoss Inc. 
  5  # 
  6  # This program is free software; you can redistribute it and/or modify it 
  7  # under the terms of the GNU General Public License version 2 as published by 
  8  # the Free Software Foundation. 
  9  # 
 10  # For complete information please visit: http://www.zenoss.com/oss/ 
 11  # 
 12  ########################################################################### 
 13   
 14  import logging 
 15  log = logging.getLogger("zen.OS") 
 16   
 17  import types 
 18   
 19  from Software import Software 
 20   
 21  from AccessControl import ClassSecurityInfo 
 22  from Globals import InitializeClass 
 23   
 24  from Products.ZenUtils.Utils import convToUnits 
 25  from Products.ZenRelations.RelSchema import * 
 26   
 27  from Products.ZenModel.Exceptions import * 
 28  from Products.ZenModel.Service import Service 
 29   
 30  from IpInterface import manage_addIpInterface 
 31  from WinService import manage_addWinService 
 32  from IpService import manage_addIpService 
 33  from OSProcess import manage_addOSProcess, OSProcess 
 34  from IpRouteEntry import manage_addIpRouteEntry 
 35  from FileSystem import manage_addFileSystem 
 36   
 37  from Products.ZenWidgets import messaging 
 38  from Products.ZenUtils.Utils import prepId 
 39   
40 -class OperatingSystem(Software):
41 42 totalSwap = 0L 43 uname = "" 44 45 _properties = Software._properties + ( 46 {'id':'totalSwap', 'type':'long', 'mode':'w'}, 47 {'id':'uname', 'type':'string', 'mode':''}, 48 ) 49 50 _relations = Software._relations + ( 51 ("interfaces", ToManyCont(ToOne, 52 "Products.ZenModel.IpInterface", "os")), 53 ("routes", ToManyCont(ToOne, "Products.ZenModel.IpRouteEntry", "os")), 54 ("ipservices", ToManyCont(ToOne, "Products.ZenModel.IpService", "os")), 55 ("winservices", ToManyCont(ToOne, 56 "Products.ZenModel.WinService", "os")), 57 ("processes", ToManyCont(ToOne, "Products.ZenModel.OSProcess", "os")), 58 ("filesystems", ToManyCont(ToOne, 59 "Products.ZenModel.FileSystem", "os")), 60 ("software", ToManyCont(ToOne, "Products.ZenModel.Software", "os")), 61 ) 62 63 security = ClassSecurityInfo() 64 65 routeTypeMap = ('other', 'invalid', 'direct', 'indirect') 66 routeProtoMap = ('other', 'local', 'netmgmt', 'icmp', 67 'egp', 'ggp', 'hello', 'rip', 'is-is', 'es-is', 68 'ciscoIgrp', 'bbnSpfIgrp', 'ospf', 'bgp') 69 70 factory_type_information = ( 71 { 72 'id' : 'Device', 73 'meta_type' : 'Device', 74 'description' : """Base class for all devices""", 75 'icon' : 'Device_icon.gif', 76 'product' : 'ZenModel', 77 'factory' : 'manage_addDevice', 78 'immediate_view' : '../deviceOsDetail', 79 'actions' : () 80 }, 81 ) 82 83
84 - def __init__(self):
85 id = "os" 86 Software.__init__(self, id) 87 self._delObject("os") # OperatingSystem is a software
88 # but doens't have os relationship 89 90
91 - def totalSwapString(self):
92 return self.totalSwap and convToUnits(self.totalSwap) or 'Unknown'
93
94 - def traceRoute(self, target, ippath):
95 """ 96 Trace the route to the target from this device using our routing 97 table and return an array of IP address strings showing the route. 98 99 If the route is not traversable (ie a gap in the routing table), 100 then return the incomplete path with a final value of None. 101 102 @parameter target: destination IP to find 103 @type target: DMD device object 104 @parameter ippath: used to store intermediate results in calls. Call with [] 105 @type ippath: array-like object used for 106 @return: IP addresses to target device 107 @rtype: array of strings 108 """ 109 log.debug("traceRoute from device %s to target %s", 110 self.getDeviceName(), target) 111 # Try to find a specific route to the target device 112 nextdev = None 113 for route in sorted(self.getRouteObjs(),key=lambda route:route.routemask,reverse=True): 114 ip = route.getNextHopIp() 115 log.debug("Route %s next hop %s", route.getTarget(), ip) 116 # Have a host-route 117 if ip == target.getManageIp(): 118 ippath.append(ip) 119 return ippath 120 121 # Have a net-route 122 if route.matchTarget(target.getManageIp()): 123 if route.routetype == 'direct': 124 nextdev = target 125 break 126 nextdev = route.getNextHopDevice() 127 break 128 else: 129 # No routes matched -- try the default route (if any) 130 log.debug("Device %s default route", self.getDeviceName()) 131 ip = "" 132 default = self.routes._getOb("0.0.0.0_0", None) 133 if default: 134 ip = default.getNextHopIp() 135 nextdev = default.getNextHopDevice() 136 137 if target == nextdev or ip == "0.0.0.0": 138 ippath.append(target.id) 139 return ippath 140 141 if nextdev: 142 ippath.append(ip) 143 return nextdev.traceRoute(target, ippath) 144 145 # Oops! No route! 146 log.debug("Unable to trace to %s, gap at %s", target.id, 147 self.getDeviceName()) 148 ippath.append(None) 149 return ippath
150 151
152 - def getRouteObjs(self):
153 """Return our real route objects. 154 """ 155 return filter(lambda r: r.target(), self.routes())
156 157
158 - def device(self):
159 """Return our Device object for DeviceResultInt. 160 """ 161 return self.getPrimaryParent()
162
163 - def deleteDeviceComponents(self, context, componentNames=[], REQUEST=None):
164 """Delete device components""" 165 if not componentNames: return self() 166 if type(componentNames) in types.StringTypes: 167 componentNames = (componentNames,) 168 for componentName in componentNames: 169 dc = context._getOb(componentName, False) 170 if dc: dc.manage_deleteComponent() 171 if REQUEST: 172 return self.callZenScreen(REQUEST)
173
174 - def unlockDeviceComponents(self, context, componentNames=[], REQUEST=None):
175 """Unlock device components""" 176 if not componentNames: return self() 177 if type(componentNames) in types.StringTypes: 178 componentNames = (componentNames,) 179 for componentName in componentNames: 180 dc = context._getOb(componentName) 181 dc.unlock() 182 if REQUEST: 183 return self.callZenScreen(REQUEST)
184
185 - def lockDeviceComponentsFromDeletion(self, context, componentNames=[], 186 sendEventWhenBlocked=None, REQUEST=None):
187 """Lock device components from deletion""" 188 if not componentNames: return self() 189 if type(componentNames) in types.StringTypes: 190 componentNames = (componentNames,) 191 for componentName in componentNames: 192 dc = context._getOb(componentName) 193 dc.lockFromDeletion(sendEventWhenBlocked) 194 if REQUEST: 195 return self.callZenScreen(REQUEST)
196
197 - def lockDeviceComponentsFromUpdates(self, context, componentNames=[], 198 sendEventWhenBlocked=None, REQUEST=None):
199 """Lock device components from updates""" 200 if not componentNames: return self() 201 if type(componentNames) in types.StringTypes: 202 componentNames = (componentNames,) 203 for componentName in componentNames: 204 dc = context._getOb(componentName, False) 205 if dc: dc.lockFromUpdates(sendEventWhenBlocked) 206 if REQUEST: 207 return self.callZenScreen(REQUEST)
208 209
210 - def addIpInterface(self, newId, userCreated, REQUEST=None):
211 """Add IpInterfaces. 212 """ 213 manage_addIpInterface(self.interfaces, newId, userCreated) 214 if REQUEST: 215 messaging.IMessageSender(self).sendToBrowser( 216 'Interface Created', 217 'IP Interface %s was created.' % newId 218 ) 219 REQUEST['RESPONSE'].redirect( 220 self.interfaces._getOb(newId).absolute_url()) 221 self._p_changed = True 222 return self.callZenScreen(REQUEST)
223
224 - def deleteIpInterfaces(self, componentNames=[], REQUEST=None):
225 """Delete IpInterfaces""" 226 self.deleteDeviceComponents(self.interfaces, componentNames, REQUEST) 227 if REQUEST: 228 messaging.IMessageSender(self).sendToBrowser( 229 'Interfaces Deleted', 230 'IP Interfaces %s was created.' % (', '.join(componentNames)) 231 ) 232 REQUEST['RESPONSE'].redirect(self.absolute_url()) 233 return self.callZenScreen(REQUEST)
234
235 - def setComponentMonitored(self, context, componentNames=[], 236 monitored=True, REQUEST=None):
237 """ 238 Set monitored status for selected components. 239 """ 240 if isinstance(context, basestring): 241 context = getattr(self, context) 242 if not componentNames: return self() 243 if isinstance(componentNames, basestring): 244 componentNames = (componentNames,) 245 monitored = bool(monitored) 246 for componentName in componentNames: 247 comp = context._getOb(componentName, False) 248 if comp and comp.monitored() != monitored: 249 comp.monitor = monitored 250 if isinstance(comp, (Service, OSProcess)): 251 comp.setAqProperty('zMonitor', monitored, 'boolean') 252 comp.index_object() 253 if REQUEST: 254 verb = monitored and "Enabled" or "Disabled" 255 messaging.IMessageSender(self).sendToBrowser( 256 'Monitoring %s' % verb, 257 'Monitoring was %s on %s.' % (verb.lower(), 258 ', '.join(componentNames)) 259 ) 260 return self.callZenScreen(REQUEST)
261
262 - def unlockIpInterfaces(self, componentNames=[], REQUEST=None):
263 """Unlock IpInterfaces""" 264 self.unlockDeviceComponents(self.interfaces, componentNames, REQUEST) 265 if REQUEST: 266 messaging.IMessageSender(self).sendToBrowser( 267 'Interfaces Unlocked', 268 'Interfaces %s were unlocked.' % (', '.join(componentNames)) 269 ) 270 REQUEST['RESPONSE'].redirect(self.absolute_url()) 271 return self.callZenScreen(REQUEST)
272
273 - def lockIpInterfacesFromDeletion(self, componentNames=[], 274 sendEventWhenBlocked=None, REQUEST=None):
275 """Lock IpInterfaces from deletion""" 276 self.lockDeviceComponentsFromDeletion(self.interfaces, componentNames, 277 sendEventWhenBlocked, REQUEST) 278 if REQUEST: 279 messaging.IMessageSender(self).sendToBrowser( 280 'Interfaces Locked', 281 'Interfaces %s were locked from deletion.' % ( 282 ', '.join(componentNames)) 283 ) 284 REQUEST['RESPONSE'].redirect(self.absolute_url()) 285 return self.callZenScreen(REQUEST)
286
287 - def lockIpInterfacesFromUpdates(self, componentNames=[], 288 sendEventWhenBlocked=None, REQUEST=None):
289 """Lock IpInterfaces from updates""" 290 self.lockDeviceComponentsFromUpdates(self.interfaces, componentNames, 291 sendEventWhenBlocked, REQUEST) 292 if REQUEST: 293 messaging.IMessageSender(self).sendToBrowser( 294 'Interfaces Locked', 295 'Interfaces %s were locked from updates and deletion.' % ( 296 ', '.join(componentNames)) 297 ) 298 REQUEST['RESPONSE'].redirect(self.absolute_url()) 299 return self.callZenScreen(REQUEST)
300
301 - def addWinService(self, newClassName, userCreated, REQUEST=None):
302 """Add an WinService. 303 """ 304 org = self.dmd.Services 305 wsc = org.unrestrictedTraverse(newClassName) 306 if wsc is not None: 307 ws = manage_addWinService(self.winservices, 308 wsc.id, 309 wsc.description, 310 userCreated=userCreated) 311 self._p_changed = True 312 elif REQUEST: 313 messaging.IMessageSender(self).sendToBrowser( 314 'No Such WinService', 315 'Could not find a WinService named %s.' % (newClassName), 316 priority=messaging.WARNING 317 ) 318 return self.callZenScreen(REQUEST) 319 320 if REQUEST: 321 messaging.IMessageSender(self).sendToBrowser( 322 'WinService Added', 323 'WinService %s was added.' % (newClassName) 324 ) 325 REQUEST['RESPONSE'].redirect(ws.absolute_url()) 326 return self.callZenScreen(REQUEST)
327
328 - def deleteWinServices(self, componentNames=[], REQUEST=None):
329 """Delete WinServices""" 330 self.deleteDeviceComponents(self.winservices, componentNames, REQUEST) 331 if REQUEST: 332 messaging.IMessageSender(self).sendToBrowser( 333 'WinServices Deleted', 334 'WinServices %s were deleted.' % (', '.join(componentNames)) 335 ) 336 REQUEST['RESPONSE'].redirect(self.absolute_url()) 337 return self.callZenScreen(REQUEST)
338
339 - def unlockWinServices(self, componentNames=[], REQUEST=None):
340 """Unlock WinServices""" 341 self.unlockDeviceComponents(self.winservices, componentNames, REQUEST) 342 if REQUEST: 343 messaging.IMessageSender(self).sendToBrowser( 344 'WinServices Unlocked', 345 'WinServices %s were unlocked.' % (', '.join(componentNames)) 346 ) 347 REQUEST['RESPONSE'].redirect(self.absolute_url()) 348 return self.callZenScreen(REQUEST)
349
350 - def lockWinServicesFromDeletion(self, componentNames=[], 351 sendEventWhenBlocked=None, REQUEST=None):
352 """Lock WinServices from deletion""" 353 self.lockDeviceComponentsFromDeletion(self.winservices, componentNames, 354 sendEventWhenBlocked, REQUEST) 355 if REQUEST: 356 messaging.IMessageSender(self).sendToBrowser( 357 'WinServices Locked', 358 'WinServices %s were locked from deletion.' % ( 359 ', '.join(componentNames)) 360 ) 361 REQUEST['RESPONSE'].redirect(self.absolute_url()) 362 return self.callZenScreen(REQUEST)
363
364 - def lockWinServicesFromUpdates(self, componentNames=[], 365 sendEventWhenBlocked=None, REQUEST=None):
366 """Lock WinServices from updates""" 367 self.lockDeviceComponentsFromUpdates(self.winservices, componentNames, 368 sendEventWhenBlocked, REQUEST) 369 if REQUEST: 370 messaging.IMessageSender(self).sendToBrowser( 371 'WinServices Locked', 372 'WinServices %s were locked from updates and deletion.' % ( 373 ', '.join(componentNames)) 374 ) 375 REQUEST['RESPONSE'].redirect(self.absolute_url()) 376 return self.callZenScreen(REQUEST)
377
378 - def getSubOSProcessClassesGen(self, REQUEST=None):
379 """Get OS Process 380 """ 381 return self.getDmdRoot('Processes').getSubOSProcessClassesGen()
382
383 - def addOSProcess(self, newClassName, userCreated, REQUEST=None):
384 """Add an OSProcess. 385 """ 386 osp = manage_addOSProcess(self.processes, newClassName, userCreated) 387 self._p_changed = True 388 if REQUEST: 389 messaging.IMessageSender(self).sendToBrowser( 390 'Process Created', 391 'OS process %s was created.' % newClassName 392 ) 393 REQUEST['RESPONSE'].redirect(osp.absolute_url())
394
395 - def deleteOSProcesses(self, componentNames=[], REQUEST=None):
396 """Delete OSProcesses""" 397 self.deleteDeviceComponents(self.processes, componentNames, REQUEST) 398 if REQUEST: 399 messaging.IMessageSender(self).sendToBrowser( 400 'Processes Deleted', 401 'OS processes %s were deleted.' % (', '.join(componentNames)) 402 ) 403 REQUEST['RESPONSE'].redirect(self.absolute_url()) 404 return self.callZenScreen(REQUEST)
405
406 - def unlockOSProcesses(self, componentNames=[], REQUEST=None):
407 """Unlock OSProcesses""" 408 self.unlockDeviceComponents(self.processes, componentNames, REQUEST) 409 if REQUEST: 410 messaging.IMessageSender(self).sendToBrowser( 411 'Processes Unlocked', 412 'OS Processes %s were unlocked.' % (', '.join(componentNames)) 413 ) 414 REQUEST['RESPONSE'].redirect(self.absolute_url()) 415 return self.callZenScreen(REQUEST)
416
417 - def lockOSProcessesFromDeletion(self, componentNames=[], 418 sendEventWhenBlocked=None, REQUEST=None):
419 """Lock OSProcesses from deletion""" 420 self.lockDeviceComponentsFromDeletion(self.processes, componentNames, 421 sendEventWhenBlocked, REQUEST) 422 if REQUEST: 423 messaging.IMessageSender(self).sendToBrowser( 424 'Processes Locked', 425 'OS processes %s were locked from deletion.' % ( 426 ', '.join(componentNames)) 427 ) 428 REQUEST['RESPONSE'].redirect(self.absolute_url()) 429 return self.callZenScreen(REQUEST)
430
431 - def lockOSProcessesFromUpdates(self, componentNames=[], 432 sendEventWhenBlocked=None, REQUEST=None):
433 """Lock OSProcesses from updates""" 434 self.lockDeviceComponentsFromUpdates(self.processes, componentNames, 435 sendEventWhenBlocked, REQUEST) 436 if REQUEST: 437 messaging.IMessageSender(self).sendToBrowser( 438 'Processes Locked', 439 'OS processes %s were locked from updates and deletion.' % ( 440 ', '.join(componentNames)) 441 ) 442 REQUEST['RESPONSE'].redirect(self.absolute_url()) 443 return self.callZenScreen(REQUEST)
444
445 - def addIpService(self, newClassName, protocol, userCreated, REQUEST=None):
446 """Add IpServices. 447 """ 448 org = self.dmd.Services 449 ipsc = org.unrestrictedTraverse(newClassName) 450 if ipsc is not None: 451 ips = manage_addIpService(self.ipservices, 452 ipsc.id, 453 protocol, 454 ipsc.port, 455 userCreated=userCreated) 456 self._p_changed = True 457 elif REQUEST: 458 messaging.IMessageSender(self).sendToBrowser( 459 'No Such WinService', 460 'Could not find an IP Service named %s.' % (newClassName), 461 priority=messaging.WARNING 462 ) 463 return self.callZenScreen(REQUEST) 464 465 if REQUEST: 466 messaging.IMessageSender(self).sendToBrowser( 467 'IP Service Added', 468 'IP Service %s was added.' % (newClassName) 469 ) 470 REQUEST['RESPONSE'].redirect(ips.absolute_url()) 471 return self.callZenScreen(REQUEST)
472
473 - def deleteIpServices(self, componentNames=[], REQUEST=None):
474 """Delete IpServices""" 475 self.deleteDeviceComponents(self.ipservices, componentNames, REQUEST) 476 if REQUEST: 477 messaging.IMessageSender(self).sendToBrowser( 478 'IP Services Deleted', 479 'IP Services %s were deleted.' % (', '.join(componentNames)) 480 ) 481 REQUEST['RESPONSE'].redirect(self.absolute_url()) 482 return self.callZenScreen(REQUEST)
483
484 - def unlockIpServices(self, componentNames=[], REQUEST=None):
485 """Unlock IpServices""" 486 self.unlockDeviceComponents(self.ipservices, componentNames, REQUEST) 487 if REQUEST: 488 messaging.IMessageSender(self).sendToBrowser( 489 'IpServices Unlocked', 490 'IP Services %s were unlocked.' % (', '.join(componentNames)) 491 ) 492 REQUEST['RESPONSE'].redirect(self.absolute_url()) 493 return self.callZenScreen(REQUEST)
494
495 - def lockIpServicesFromDeletion(self, componentNames=[], 496 sendEventWhenBlocked=None, REQUEST=None):
497 """Lock IpServices from deletion""" 498 self.lockDeviceComponentsFromDeletion(self.ipservices, componentNames, 499 sendEventWhenBlocked, REQUEST) 500 if REQUEST: 501 messaging.IMessageSender(self).sendToBrowser( 502 'Services Locked', 503 'IP services %s were locked from deletion.' % ( 504 ', '.join(componentNames)) 505 ) 506 REQUEST['RESPONSE'].redirect(self.absolute_url()) 507 return self.callZenScreen(REQUEST)
508
509 - def lockIpServicesFromUpdates(self, componentNames=[], 510 sendEventWhenBlocked=None, REQUEST=None):
511 """Lock IpServices from updates""" 512 self.lockDeviceComponentsFromUpdates(self.ipservices, componentNames, 513 sendEventWhenBlocked, REQUEST) 514 if REQUEST: 515 messaging.IMessageSender(self).sendToBrowser( 516 'Services Locked', 517 'IP services %s were locked from updates and deletion.' % ( 518 ', '.join(componentNames)) 519 ) 520 REQUEST['RESPONSE'].redirect(self.absolute_url()) 521 return self.callZenScreen(REQUEST)
522
523 - def addFileSystem(self, newId, userCreated, REQUEST=None):
524 """Add a FileSystem. 525 """ 526 fsid = prepId(newId) 527 manage_addFileSystem(self.filesystems, newId, userCreated) 528 self._p_changed = True 529 if REQUEST: 530 messaging.IMessageSender(self).sendToBrowser( 531 'Filesystem Added', 532 'Filesystem %s was added.' % newId 533 ) 534 REQUEST['RESPONSE'].redirect( 535 self.filesystems._getOb(fsid).absolute_url()) 536 return self.callZenScreen(REQUEST)
537
538 - def deleteFileSystems(self, componentNames=[], REQUEST=None):
539 """Delete FileSystems""" 540 self.deleteDeviceComponents(self.filesystems, componentNames, REQUEST) 541 if REQUEST: 542 messaging.IMessageSender(self).sendToBrowser( 543 'Filesystems Deleted', 544 'Filesystems %s were deleted.' % (', '.join(componentNames)) 545 ) 546 REQUEST['RESPONSE'].redirect(self.absolute_url()) 547 return self.callZenScreen(REQUEST)
548
549 - def unlockFileSystems(self, componentNames=[], REQUEST=None):
550 """Unlock FileSystems""" 551 self.unlockDeviceComponents(self.filesystems, componentNames, REQUEST) 552 if REQUEST: 553 messaging.IMessageSender(self).sendToBrowser( 554 'Filesystems Unlocked', 555 'Filesystems %s were unlocked.' % (', '.join(componentNames)) 556 ) 557 REQUEST['RESPONSE'].redirect(self.absolute_url()) 558 return self.callZenScreen(REQUEST)
559
560 - def lockFileSystemsFromDeletion(self, componentNames=[], 561 sendEventWhenBlocked=None, REQUEST=None):
562 """Lock FileSystems from deletion""" 563 self.lockDeviceComponentsFromDeletion(self.filesystems, componentNames, 564 sendEventWhenBlocked, REQUEST) 565 if REQUEST: 566 messaging.IMessageSender(self).sendToBrowser( 567 'Filesystems Locked', 568 'Filesystems %s were locked from deletion.' % ( 569 ', '.join(componentNames)) 570 ) 571 REQUEST['RESPONSE'].redirect(self.absolute_url()) 572 return self.callZenScreen(REQUEST)
573
574 - def lockFileSystemsFromUpdates(self, componentNames=[], 575 sendEventWhenBlocked=None, REQUEST=None):
576 """Lock FileSystems from updates""" 577 self.lockDeviceComponentsFromUpdates(self.filesystems, componentNames, 578 sendEventWhenBlocked, REQUEST) 579 if REQUEST: 580 messaging.IMessageSender(self).sendToBrowser( 581 'Filesystems Locked', 582 'Filesystems %s were locked from updates and deletion.' % ( 583 ', '.join(componentNames)) 584 ) 585 REQUEST['RESPONSE'].redirect(self.absolute_url()) 586 return self.callZenScreen(REQUEST)
587
588 - def addIpRouteEntry(self, dest, routemask, nexthopid, interface, 589 routeproto, routetype, userCreated, REQUEST=None):
590 """Add an IpRouteEntry. 591 """ 592 manage_addIpRouteEntry(self.routes, 593 dest, 594 routemask, 595 nexthopid, 596 interface, 597 routeproto, 598 routetype, 599 userCreated=userCreated) 600 self._p_changed = True 601 if REQUEST: 602 messaging.IMessageSender(self).sendToBrowser( 603 'Route Created', 604 'IP route entry was created.' 605 ) 606 REQUEST['RESPONSE'].redirect(self.absolute_url()) 607 return self.callZenScreen(REQUEST)
608
609 - def deleteIpRouteEntries(self, componentNames=[], REQUEST=None):
610 """Delete IpRouteEntries""" 611 self.deleteDeviceComponents(self.routes, componentNames, REQUEST) 612 if REQUEST: 613 messaging.IMessageSender(self).sendToBrowser( 614 'Routes Deleted', 615 'IP route entries %s were deleted.' % (', '.join(componentNames)) 616 ) 617 REQUEST['RESPONSE'].redirect(self.absolute_url()) 618 return self.callZenScreen(REQUEST)
619
620 - def unlockIpRouteEntries(self, componentNames=[], REQUEST=None):
621 """Unlock IpRouteEntries""" 622 self.unlockDeviceComponents(self.routes, componentNames, REQUEST) 623 if REQUEST: 624 messaging.IMessageSender(self).sendToBrowser( 625 'Routes Unlocked', 626 'IP route entries %s were unlocked.' % ( 627 ', '.join(componentNames)) 628 ) 629 REQUEST['RESPONSE'].redirect(self.absolute_url()) 630 return self.callZenScreen(REQUEST)
631
632 - def lockIpRouteEntriesFromDeletion(self, componentNames=[], 633 sendEventWhenBlocked=None, REQUEST=None):
634 """Lock IpRouteEntries from deletion""" 635 self.lockDeviceComponentsFromDeletion(self.routes, componentNames, 636 sendEventWhenBlocked, REQUEST) 637 if REQUEST: 638 messaging.IMessageSender(self).sendToBrowser( 639 'Routes Locked', 640 'IP route entries %s were locked from deletion.' % ( 641 ', '.join(componentNames)) 642 ) 643 REQUEST['RESPONSE'].redirect(self.absolute_url()) 644 return self.callZenScreen(REQUEST)
645
646 - def lockIpRouteEntriesFromUpdates(self, componentNames=[], 647 sendEventWhenBlocked=None, REQUEST=None):
648 """Lock IpRouteEntries from updates""" 649 self.lockDeviceComponentsFromUpdates(self.routes, componentNames, 650 sendEventWhenBlocked, REQUEST) 651 if REQUEST: 652 messaging.IMessageSender(self).sendToBrowser( 653 'Routes Locked', 654 'IP route entries %s were locked from updates and deletion.' % ( 655 ', '.join(componentNames)) 656 ) 657 REQUEST['RESPONSE'].redirect(self.absolute_url()) 658 return self.callZenScreen(REQUEST)
659 660 InitializeClass(OperatingSystem) 661