Question about operation 'delete' and 'remove'

Hi, 

I have a list 'peer, which has a container 'local-tcp-source ' with a mandatory leaf 'local-tcp-source'. 

    list peer {
      key "peer";
      description
        "MSDP peer";
      leaf peer {
        type inet:ipv4-address;
        description
          "IP Address of peer";
      }
      container local-tcp-source {
        description
          "TCP source for MSDP connection";
        leaf local-tcp-source {
          type string;
          mandatory true;
          description
            "Interface name";
        }
      }

When I did 'delete' with below message, it is OK. 

<msdpipos:peer xc:operation="delete">  //list 
         <msdpipos:peer>192.168.1.1</msdpipos:peer> //key
         <msdpipos:local-tcp-source>
                   <msdpipos:local-tcp-source>test-int2</msdpipos:local-tcp-source> //mandatory
         </msdpipos:local-tcp-source>
         <msdpipos:description>msdp-test-peer22</msdpipos:description>
         <msdpipos:data-ttl-threshold>200</msdpipos:data-ttl-threshold>
         <msdpipos:peer-as>99:01</msdpipos:peer-as>
</msdpipos:peer>

But when I did 'remove', 
<msdpipos:peer xc:operation="remove">  //list 
         <msdpipos:peer>192.168.1.1</msdpipos:peer> //key
         <msdpipos:local-tcp-source>
                   <msdpipos:local-tcp-source>test-int2</msdpipos:local-tcp-source> //mandatory
         </msdpipos:local-tcp-source>
         <msdpipos:description>msdp-test-peer22</msdpipos:description>
         <msdpipos:data-ttl-threshold>200</msdpipos:data-ttl-threshold>
         <msdpipos:peer-as>99:01</msdpipos:peer-as>
</msdpipos:peer>


I got below error:
<error-type>protocol</error-type>
<error-tag>operation-failed</error-tag>
<error-severity>error</error-severity>
<error-path xmlns:msdpipos="urn:rdns:com:ericsson:oammodel:ericsson-msdp-ipos" xmlns:ctxipos="urn:rdns:com:ericsson:oammodel:ericsson-context-ipos" xmlns:ctxsipos="urn:rdns:com:ericsson:oammodel:ericsson-contexts-ipos">
    /rpc/edit-config/config/ctxsipos:contexts/ctxipos:context/ctxipos:router/msdpipos:msdp/msdpipos:peer/msdpipos:local-tcp-source/msdpipos:local-tcp-source
  </error-path><error-info><bad-element>local-tcp-source</bad-element>
</error-info>
</rpc-error>

Anyone knows why it happened?

I didn’t get your question correctly. But try to convey some info.

You cannot delete a mandatory leaf alone. You can delete the list entry. There is no such thing as remove operation, only delete operation exists.