'Merge interface attributes.'

def merge_interface(self, ifname, description, admin_state, mode):

    xmlstr = ''
    change = False
    self.updates_cmd.append(('interface    %s' % ifname))
    if (description and (self.intf_info['ifDescr'] != description)):
        xmlstr += (CE_NC_XML_MERGE_INTF_DES % (ifname, description))
        self.updates_cmd.append(('description    %s' % description))
        change = True
    if (admin_state and is_admin_state_enable(self.intf_type) and (self.intf_info['ifAdminStatus'] != admin_state)):
        xmlstr += (CE_NC_XML_MERGE_INTF_STATUS % (ifname, admin_state))
        change = True
        if (admin_state == 'up'):
            self.updates_cmd.append('undo    shutdown')
        else:
            self.updates_cmd.append('shutdown')
    if is_portswitch_enalbe(self.intf_type):
        if ((mode == 'layer2') and (self.intf_info['isL2SwitchPort'] != 'true')):
            xmlstr += (CE_NC_XML_MERGE_INTF_L2ENABLE % (ifname, 'enable'))
            self.updates_cmd.append('portswitch')
            change = True
        elif ((mode == 'layer3') and (self.intf_info['isL2SwitchPort'] != 'false')):
            xmlstr += (CE_NC_XML_MERGE_INTF_L2ENABLE % (ifname, 'disable'))
            self.updates_cmd.append('undo    portswitch')
            change = True
    if (not change):
        return
    conf_str = (('<config>    ' + xmlstr) + '    </config>')
    recv_xml = set_nc_config(self.module, conf_str)
    self.check_response(recv_xml, 'MERGE_INTF_ATTR')
    self.changed = True
