Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for DELETE obejct on list level #55

Closed
psykokwak4 opened this issue Apr 25, 2016 · 4 comments
Closed

Support for DELETE obejct on list level #55

psykokwak4 opened this issue Apr 25, 2016 · 4 comments
Assignees
Milestone

Comments

@psykokwak4
Copy link
Contributor

psykokwak4 commented Apr 25, 2016

Background

Currently the DELETE object supports deletion on leaf and container level for CRUD update operation, which provide user with flexibility to delete and create attribute at the same time. However we lack the support for using DELETE object on list.

Proposal

We could add an attribute or property _delete on python class created from list statement, and with this attribute being set as DELETE object, we could provide user the capability to delete list element with specified list key. For example,

    bgp_cfg = bgp.Bgp()

    bgp_cfg.global_.config.as_ = 65001

    ipv4_afsf = bgp_cfg.global_.afi_safis.AfiSafi()
    ipv4_afsf.afi_safi_name = 'ipv4-unicast'
    ipv4_afsf.config.afi_safi_name = 'ipv4-unicast'
    ipv4_afsf.config.enabled = True

    ipv6_afsf = bgp_cfg.global_.afi_safis.AfiSafi()
    ipv6_afsf.afi_safi_name = 'ipv6-unicast'
    ipv6_afsf.config.afi_safi_name = 'ipv6-unicast'
    ipv6_afsf.config.enabled = True
    ipv6_afsf.delete = DELETE()

    bgp_cfg.global_.afi_safis.afi_safi.append(ipv4_afsf)
    bgp_cfg.global_.afi_safis.afi_safi.append(ipv6_afsf)

CRUD update operation on bgp_cfg will delete this ipv6 afsf and create ipv4 afsf.

@psykokwak4 psykokwak4 added this to the 0.4.1 milestone Apr 25, 2016
@psykokwak4 psykokwak4 self-assigned this Apr 25, 2016
@psykokwak4 psykokwak4 changed the title Support for DELETE obejct Support for DELETE obejct on list level Apr 27, 2016
@manradhaCisco
Copy link
Contributor

DELETE is and SHOULD only be applicable on leafs/leaf-list.
Not on containers or lists. For that one would use the DELETE service in CRUD

DELETE roughly corresponds to the no command , where you set the value of a leaf/leaf-list to it's default value (or erase the value completel)

The update operation SHOULD NOT be used to delete list items or presence containers .

The name DELETE might be a misnomer here . Where is this requirement coming from??

@psykokwak4
Copy link
Contributor Author

Coming from a demo script. The user want to delete all items in a list, and try to assign a DELETE object for an instance of python class generated by list statement. Checked the use example in rfc 6241:

     <rpc message-id="101"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <edit-config>
         <target>
           <running/>
         </target>
         <default-operation>none</default-operation>
         <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
           <top xmlns="http://example.com/schema/1.2/config">
             <protocols>
               <ospf>
                 <area>
                   <name>0.0.0.0</name>
                   <interfaces>
                     <interface xc:operation="delete">
                       <name>192.0.2.4</name>
                     </interface>
                   </interfaces>
                 </area>
               </ospf>
             </protocols>
           </top>
         </config>
       </edit-co

thought this would be a reasonable use case. We might need to add documentation for DELETE object?

@einarnn
Copy link
Contributor

einarnn commented Apr 27, 2016

I think Manu is correct that we shouldn't be doing a delete as part of an update. We discussed this extensively while refining the semantics of the CRUD service. If we want to combine update, create and delete in a single operation, then what we need to have is a "NETCONF Service".

@psykokwak4
Copy link
Contributor Author

Great, then we will close this issue. And the user should use NETCONF service if the combination of create, delete and update is needed in a single operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants