Config files aren’t aren’t normal config files but special “checkpoint” files.
That’s because on NXOS the only way to replace a config without reboot is to rollback to a checkpoint (which could be a file).
These files explicitly list a lot of normally implicit config lines, some of them starting with !#.
The !# part isn’t necessary for the rollback to work, but leaving these lines out can cause erratic behavior.
See the “Known gotchas” section below.

An example of a checkpoint file can be seen in test/unit/nxos/new_good.conf.
You can get a checkpoint file representing your device’s current config by running the _get_checkpoint_file()
function in the napalm.nxos driver:

Leaving out a shutdown or noshutdown line will cause the switch to toggle the up/down state of an interface, depending on it’s current state.

!#switchporttrunkallowedvlan1-4094 is required even if the switchport is in switchportmodeaccess. However if !#switchporttrunkallowedvlan1-4094 is included with noswitchport, the configuration replacement will fail.

Vlans are listed vertically. For example vlan1,10,20,30 will fail. To succeed, you need: