# -*- coding: utf-8 -*-
##----------------------------------------------------------------------
## Zyxel.ZyNOS.remove_vlan
##----------------------------------------------------------------------
## Copyright (C) 2007-2011 The NOC Project
## See LICENSE for details
##----------------------------------------------------------------------
"""
"""
from __future__ import with_statement
## NOC modules
from noc.sa.script import Script as NOCScript
from noc.sa.interfaces import IRemoveVlan
##
## Zyxel.ZyNOS.remove_vlan
##
class Script(NOCScript):
    name="Zyxel.ZyNOS.remove_vlan"
    implements=[IRemoveVlan]
    def execute(self,vlan_id):
        for v in  self.scripts.get_vlans():
            if v["vlan_id"]==vlan_id:
                with self.configure():
                    self.cli("no vlan %s"%v["vlan_id"])
                self.save_config()
                return True
        return False
    
