'worker'

def work(self):

    self.check_params()
    if self.interface:
        self.intf_info = self.get_interface_dict(self.interface)
        self.get_existing()
        if (self.state == 'present'):
            if (not self.intf_info):
                self.create_interface(self.interface, self.description, self.admin_state, self.mode, self.l2sub)
            elif (self.description or self.admin_state or self.mode):
                self.merge_interface(self.interface, self.description, self.admin_state, self.mode)
        elif (self.state == 'absent'):
            if self.intf_info:
                self.delete_interface(self.interface)
            else:
                self.module.fail_json(msg='Error:    interface    does    not    exists.')
        elif (not self.intf_info):
            self.module.fail_json(msg='Error:    interface    does    not    exists.')
        else:
            self.default_interface(self.interface)
    else:
        self.intfs_info = self.get_interfaces_dict()
        self.get_existing()
        if (self.state == 'present'):
            if self.intfs_info.get(self.intf_type.lower()):
                if (self.description or self.admin_state or self.mode):
                    self.merge_interfaces(self.intf_type, self.description, self.admin_state, self.mode)
        elif (self.state == 'absent'):
            if self.intfs_info.get(self.intf_type.lower()):
                self.delete_interfaces(self.intf_type)
        elif self.intfs_info.get(self.intf_type.lower()):
            self.default_interfaces(self.intf_type)
        else:
            self.module.fail_json(msg='Error:    no    interface    in    this    type.')
    self.get_proposed()
    self.get_end_state()
    self.results['changed'] = self.changed
    self.results['proposed'] = self.proposed
    self.results['existing'] = self.existing
    self.results['end_state'] = self.end_state
    if self.changed:
        self.results['updates'] = self.updates_cmd
    else:
        self.results['updates'] = list()
    self.module.exit_json(**self.results)
